{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE Trustworthy #-}
module Data.Semigroup (
Semigroup(..)
, stimesMonoid
, stimesIdempotent
, stimesIdempotentMonoid
, mtimesDefault
, Min(..)
, Max(..)
, First(..)
, Last(..)
, WrappedMonoid(..)
, Dual(..)
, Endo(..)
, All(..)
, Any(..)
, Sum(..)
, Product(..)
, diff
, cycle1
, Arg(..)
, ArgMin
, ArgMax
) where
import Prelude hiding (foldr1)
import GHC.Base (Semigroup(..))
import Data.Semigroup.Internal
import Control.Applicative
import Control.Monad.Fix
import Data.Bifoldable
import Data.Bifunctor
import Data.Bitraversable
import Data.Coerce
import Data.Data
import GHC.Generics
cycle1 :: Semigroup m => m -> m
cycle1 :: forall m. Semigroup m => m -> m
cycle1 m
xs = m
xs' where xs' :: m
xs' = m
xs forall a. Semigroup a => a -> a -> a
<> m
xs'
diff :: Semigroup m => m -> Endo m
diff :: forall m. Semigroup m => m -> Endo m
diff = forall a. (a -> a) -> Endo a
Endo forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Semigroup a => a -> a -> a
(<>)
newtype Min a = Min { forall a. Min a -> a
getMin :: a }
deriving ( Min a
forall a. a -> a -> Bounded a
forall a. Bounded a => Min a
maxBound :: Min a
$cmaxBound :: forall a. Bounded a => Min a
minBound :: Min a
$cminBound :: forall a. Bounded a => Min a
Bounded
, Min a -> Min a -> Bool
forall a. Eq a => Min a -> Min a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Min a -> Min a -> Bool
$c/= :: forall a. Eq a => Min a -> Min a -> Bool
== :: Min a -> Min a -> Bool
$c== :: forall a. Eq a => Min a -> Min a -> Bool
Eq
, Min a -> Min a -> Bool
Min a -> Min a -> Ordering
Min a -> Min a -> Min a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Min a)
forall a. Ord a => Min a -> Min a -> Bool
forall a. Ord a => Min a -> Min a -> Ordering
forall a. Ord a => Min a -> Min a -> Min a
min :: Min a -> Min a -> Min a
$cmin :: forall a. Ord a => Min a -> Min a -> Min a
max :: Min a -> Min a -> Min a
$cmax :: forall a. Ord a => Min a -> Min a -> Min a
>= :: Min a -> Min a -> Bool
$c>= :: forall a. Ord a => Min a -> Min a -> Bool
> :: Min a -> Min a -> Bool
$c> :: forall a. Ord a => Min a -> Min a -> Bool
<= :: Min a -> Min a -> Bool
$c<= :: forall a. Ord a => Min a -> Min a -> Bool
< :: Min a -> Min a -> Bool
$c< :: forall a. Ord a => Min a -> Min a -> Bool
compare :: Min a -> Min a -> Ordering
$ccompare :: forall a. Ord a => Min a -> Min a -> Ordering
Ord
, Int -> Min a -> ShowS
forall a. Show a => Int -> Min a -> ShowS
forall a. Show a => [Min a] -> ShowS
forall a. Show a => Min a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Min a] -> ShowS
$cshowList :: forall a. Show a => [Min a] -> ShowS
show :: Min a -> String
$cshow :: forall a. Show a => Min a -> String
showsPrec :: Int -> Min a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Min a -> ShowS
Show
, ReadPrec [Min a]
ReadPrec (Min a)
ReadS [Min a]
forall a. Read a => ReadPrec [Min a]
forall a. Read a => ReadPrec (Min a)
forall a. Read a => Int -> ReadS (Min a)
forall a. Read a => ReadS [Min a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Min a]
$creadListPrec :: forall a. Read a => ReadPrec [Min a]
readPrec :: ReadPrec (Min a)
$creadPrec :: forall a. Read a => ReadPrec (Min a)
readList :: ReadS [Min a]
$creadList :: forall a. Read a => ReadS [Min a]
readsPrec :: Int -> ReadS (Min a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Min a)
Read
, Min a -> Constr
Min a -> DataType
forall {a}. Data a => Typeable (Min a)
forall a. Data a => Min a -> Constr
forall a. Data a => Min a -> DataType
forall a. Data a => (forall b. Data b => b -> b) -> Min a -> Min a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Min a -> u
forall a u. Data a => (forall d. Data d => d -> u) -> Min a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r
forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Min a -> m (Min a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Min a -> m (Min a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Min a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Min a -> c (Min a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Min a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Min a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Min a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Min a -> c (Min a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Min a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Min a -> m (Min a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Min a -> m (Min a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Min a -> m (Min a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Min a -> m (Min a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Min a -> m (Min a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Min a -> m (Min a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Min a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Min a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Min a -> [u]
$cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> Min a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r
gmapT :: (forall b. Data b => b -> b) -> Min a -> Min a
$cgmapT :: forall a. Data a => (forall b. Data b => b -> b) -> Min a -> Min a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Min a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Min a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Min a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Min a))
dataTypeOf :: Min a -> DataType
$cdataTypeOf :: forall a. Data a => Min a -> DataType
toConstr :: Min a -> Constr
$ctoConstr :: forall a. Data a => Min a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Min a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Min a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Min a -> c (Min a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Min a -> c (Min a)
Data
, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Min a) x -> Min a
forall a x. Min a -> Rep (Min a) x
$cto :: forall a x. Rep (Min a) x -> Min a
$cfrom :: forall a x. Min a -> Rep (Min a) x
Generic
, forall a. Rep1 Min a -> Min a
forall a. Min a -> Rep1 Min a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 Min a -> Min a
$cfrom1 :: forall a. Min a -> Rep1 Min a
Generic1
)
instance Enum a => Enum (Min a) where
succ :: Min a -> Min a
succ (Min a
a) = forall a. a -> Min a
Min (forall a. Enum a => a -> a
succ a
a)
pred :: Min a -> Min a
pred (Min a
a) = forall a. a -> Min a
Min (forall a. Enum a => a -> a
pred a
a)
toEnum :: Int -> Min a
toEnum = forall a. a -> Min a
Min forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => Int -> a
toEnum
fromEnum :: Min a -> Int
fromEnum = forall a. Enum a => a -> Int
fromEnum forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Min a -> a
getMin
enumFrom :: Min a -> [Min a]
enumFrom (Min a
a) = forall a. a -> Min a
Min forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> [a]
enumFrom a
a
enumFromThen :: Min a -> Min a -> [Min a]
enumFromThen (Min a
a) (Min a
b) = forall a. a -> Min a
Min forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromThen a
a a
b
enumFromTo :: Min a -> Min a -> [Min a]
enumFromTo (Min a
a) (Min a
b) = forall a. a -> Min a
Min forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromTo a
a a
b
enumFromThenTo :: Min a -> Min a -> Min a -> [Min a]
enumFromThenTo (Min a
a) (Min a
b) (Min a
c) = forall a. a -> Min a
Min forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo a
a a
b a
c
instance Ord a => Semigroup (Min a) where
<> :: Min a -> Min a -> Min a
(<>) = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Ord a => a -> a -> a
min :: a -> a -> a)
stimes :: forall b. Integral b => b -> Min a -> Min a
stimes = forall b a. Integral b => b -> a -> a
stimesIdempotent
instance (Ord a, Bounded a) => Monoid (Min a) where
mempty :: Min a
mempty = forall a. Bounded a => a
maxBound
instance Functor Min where
fmap :: forall a b. (a -> b) -> Min a -> Min b
fmap a -> b
f (Min a
x) = forall a. a -> Min a
Min (a -> b
f a
x)
instance Foldable Min where
foldMap :: forall m a. Monoid m => (a -> m) -> Min a -> m
foldMap a -> m
f (Min a
a) = a -> m
f a
a
instance Traversable Min where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Min a -> f (Min b)
traverse a -> f b
f (Min a
a) = forall a. a -> Min a
Min forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a
instance Applicative Min where
pure :: forall a. a -> Min a
pure = forall a. a -> Min a
Min
Min a
a <* :: forall a b. Min a -> Min b -> Min a
<* Min b
_ = Min a
a
Min a
_ *> :: forall a b. Min a -> Min b -> Min b
*> Min b
a = Min b
a
<*> :: forall a b. Min (a -> b) -> Min a -> Min b
(<*>) = coerce :: forall a b. Coercible a b => a -> b
coerce
liftA2 :: forall a b c. (a -> b -> c) -> Min a -> Min b -> Min c
liftA2 = coerce :: forall a b. Coercible a b => a -> b
coerce
instance Monad Min where
>> :: forall a b. Min a -> Min b -> Min b
(>>) = forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
(*>)
Min a
a >>= :: forall a b. Min a -> (a -> Min b) -> Min b
>>= a -> Min b
f = a -> Min b
f a
a
instance MonadFix Min where
mfix :: forall a. (a -> Min a) -> Min a
mfix a -> Min a
f = forall a. (a -> a) -> a
fix (a -> Min a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Min a -> a
getMin)
instance Num a => Num (Min a) where
(Min a
a) + :: Min a -> Min a -> Min a
+ (Min a
b) = forall a. a -> Min a
Min (a
a forall a. Num a => a -> a -> a
+ a
b)
(Min a
a) * :: Min a -> Min a -> Min a
* (Min a
b) = forall a. a -> Min a
Min (a
a forall a. Num a => a -> a -> a
* a
b)
(Min a
a) - :: Min a -> Min a -> Min a
- (Min a
b) = forall a. a -> Min a
Min (a
a forall a. Num a => a -> a -> a
- a
b)
negate :: Min a -> Min a
negate (Min a
a) = forall a. a -> Min a
Min (forall a. Num a => a -> a
negate a
a)
abs :: Min a -> Min a
abs (Min a
a) = forall a. a -> Min a
Min (forall a. Num a => a -> a
abs a
a)
signum :: Min a -> Min a
signum (Min a
a) = forall a. a -> Min a
Min (forall a. Num a => a -> a
signum a
a)
fromInteger :: Integer -> Min a
fromInteger = forall a. a -> Min a
Min forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger
newtype Max a = Max { forall a. Max a -> a
getMax :: a }
deriving ( Max a
forall a. a -> a -> Bounded a
forall a. Bounded a => Max a
maxBound :: Max a
$cmaxBound :: forall a. Bounded a => Max a
minBound :: Max a
$cminBound :: forall a. Bounded a => Max a
Bounded
, Max a -> Max a -> Bool
forall a. Eq a => Max a -> Max a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Max a -> Max a -> Bool
$c/= :: forall a. Eq a => Max a -> Max a -> Bool
== :: Max a -> Max a -> Bool
$c== :: forall a. Eq a => Max a -> Max a -> Bool
Eq
, Max a -> Max a -> Bool
Max a -> Max a -> Ordering
Max a -> Max a -> Max a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Max a)
forall a. Ord a => Max a -> Max a -> Bool
forall a. Ord a => Max a -> Max a -> Ordering
forall a. Ord a => Max a -> Max a -> Max a
min :: Max a -> Max a -> Max a
$cmin :: forall a. Ord a => Max a -> Max a -> Max a
max :: Max a -> Max a -> Max a
$cmax :: forall a. Ord a => Max a -> Max a -> Max a
>= :: Max a -> Max a -> Bool
$c>= :: forall a. Ord a => Max a -> Max a -> Bool
> :: Max a -> Max a -> Bool
$c> :: forall a. Ord a => Max a -> Max a -> Bool
<= :: Max a -> Max a -> Bool
$c<= :: forall a. Ord a => Max a -> Max a -> Bool
< :: Max a -> Max a -> Bool
$c< :: forall a. Ord a => Max a -> Max a -> Bool
compare :: Max a -> Max a -> Ordering
$ccompare :: forall a. Ord a => Max a -> Max a -> Ordering
Ord
, Int -> Max a -> ShowS
forall a. Show a => Int -> Max a -> ShowS
forall a. Show a => [Max a] -> ShowS
forall a. Show a => Max a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Max a] -> ShowS
$cshowList :: forall a. Show a => [Max a] -> ShowS
show :: Max a -> String
$cshow :: forall a. Show a => Max a -> String
showsPrec :: Int -> Max a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Max a -> ShowS
Show
, ReadPrec [Max a]
ReadPrec (Max a)
ReadS [Max a]
forall a. Read a => ReadPrec [Max a]
forall a. Read a => ReadPrec (Max a)
forall a. Read a => Int -> ReadS (Max a)
forall a. Read a => ReadS [Max a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Max a]
$creadListPrec :: forall a. Read a => ReadPrec [Max a]
readPrec :: ReadPrec (Max a)
$creadPrec :: forall a. Read a => ReadPrec (Max a)
readList :: ReadS [Max a]
$creadList :: forall a. Read a => ReadS [Max a]
readsPrec :: Int -> ReadS (Max a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Max a)
Read
, Max a -> Constr
Max a -> DataType
forall {a}. Data a => Typeable (Max a)
forall a. Data a => Max a -> Constr
forall a. Data a => Max a -> DataType
forall a. Data a => (forall b. Data b => b -> b) -> Max a -> Max a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Max a -> u
forall a u. Data a => (forall d. Data d => d -> u) -> Max a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r
forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Max a -> m (Max a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Max a -> m (Max a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Max a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Max a -> c (Max a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Max a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Max a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Max a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Max a -> c (Max a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Max a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Max a -> m (Max a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Max a -> m (Max a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Max a -> m (Max a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Max a -> m (Max a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Max a -> m (Max a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Max a -> m (Max a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Max a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Max a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Max a -> [u]
$cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> Max a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r
gmapT :: (forall b. Data b => b -> b) -> Max a -> Max a
$cgmapT :: forall a. Data a => (forall b. Data b => b -> b) -> Max a -> Max a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Max a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Max a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Max a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Max a))
dataTypeOf :: Max a -> DataType
$cdataTypeOf :: forall a. Data a => Max a -> DataType
toConstr :: Max a -> Constr
$ctoConstr :: forall a. Data a => Max a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Max a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Max a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Max a -> c (Max a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Max a -> c (Max a)
Data
, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Max a) x -> Max a
forall a x. Max a -> Rep (Max a) x
$cto :: forall a x. Rep (Max a) x -> Max a
$cfrom :: forall a x. Max a -> Rep (Max a) x
Generic
, forall a. Rep1 Max a -> Max a
forall a. Max a -> Rep1 Max a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 Max a -> Max a
$cfrom1 :: forall a. Max a -> Rep1 Max a
Generic1
)
instance Enum a => Enum (Max a) where
succ :: Max a -> Max a
succ (Max a
a) = forall a. a -> Max a
Max (forall a. Enum a => a -> a
succ a
a)
pred :: Max a -> Max a
pred (Max a
a) = forall a. a -> Max a
Max (forall a. Enum a => a -> a
pred a
a)
toEnum :: Int -> Max a
toEnum = forall a. a -> Max a
Max forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => Int -> a
toEnum
fromEnum :: Max a -> Int
fromEnum = forall a. Enum a => a -> Int
fromEnum forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Max a -> a
getMax
enumFrom :: Max a -> [Max a]
enumFrom (Max a
a) = forall a. a -> Max a
Max forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> [a]
enumFrom a
a
enumFromThen :: Max a -> Max a -> [Max a]
enumFromThen (Max a
a) (Max a
b) = forall a. a -> Max a
Max forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromThen a
a a
b
enumFromTo :: Max a -> Max a -> [Max a]
enumFromTo (Max a
a) (Max a
b) = forall a. a -> Max a
Max forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromTo a
a a
b
enumFromThenTo :: Max a -> Max a -> Max a -> [Max a]
enumFromThenTo (Max a
a) (Max a
b) (Max a
c) = forall a. a -> Max a
Max forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo a
a a
b a
c
instance Ord a => Semigroup (Max a) where
<> :: Max a -> Max a -> Max a
(<>) = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Ord a => a -> a -> a
max :: a -> a -> a)
stimes :: forall b. Integral b => b -> Max a -> Max a
stimes = forall b a. Integral b => b -> a -> a
stimesIdempotent
instance (Ord a, Bounded a) => Monoid (Max a) where
mempty :: Max a
mempty = forall a. Bounded a => a
minBound
instance Functor Max where
fmap :: forall a b. (a -> b) -> Max a -> Max b
fmap a -> b
f (Max a
x) = forall a. a -> Max a
Max (a -> b
f a
x)
instance Foldable Max where
foldMap :: forall m a. Monoid m => (a -> m) -> Max a -> m
foldMap a -> m
f (Max a
a) = a -> m
f a
a
instance Traversable Max where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Max a -> f (Max b)
traverse a -> f b
f (Max a
a) = forall a. a -> Max a
Max forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a
instance Applicative Max where
pure :: forall a. a -> Max a
pure = forall a. a -> Max a
Max
Max a
a <* :: forall a b. Max a -> Max b -> Max a
<* Max b
_ = Max a
a
Max a
_ *> :: forall a b. Max a -> Max b -> Max b
*> Max b
a = Max b
a
<*> :: forall a b. Max (a -> b) -> Max a -> Max b
(<*>) = coerce :: forall a b. Coercible a b => a -> b
coerce
liftA2 :: forall a b c. (a -> b -> c) -> Max a -> Max b -> Max c
liftA2 = coerce :: forall a b. Coercible a b => a -> b
coerce
instance Monad Max where
>> :: forall a b. Max a -> Max b -> Max b
(>>) = forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
(*>)
Max a
a >>= :: forall a b. Max a -> (a -> Max b) -> Max b
>>= a -> Max b
f = a -> Max b
f a
a
instance MonadFix Max where
mfix :: forall a. (a -> Max a) -> Max a
mfix a -> Max a
f = forall a. (a -> a) -> a
fix (a -> Max a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Max a -> a
getMax)
instance Num a => Num (Max a) where
(Max a
a) + :: Max a -> Max a -> Max a
+ (Max a
b) = forall a. a -> Max a
Max (a
a forall a. Num a => a -> a -> a
+ a
b)
(Max a
a) * :: Max a -> Max a -> Max a
* (Max a
b) = forall a. a -> Max a
Max (a
a forall a. Num a => a -> a -> a
* a
b)
(Max a
a) - :: Max a -> Max a -> Max a
- (Max a
b) = forall a. a -> Max a
Max (a
a forall a. Num a => a -> a -> a
- a
b)
negate :: Max a -> Max a
negate (Max a
a) = forall a. a -> Max a
Max (forall a. Num a => a -> a
negate a
a)
abs :: Max a -> Max a
abs (Max a
a) = forall a. a -> Max a
Max (forall a. Num a => a -> a
abs a
a)
signum :: Max a -> Max a
signum (Max a
a) = forall a. a -> Max a
Max (forall a. Num a => a -> a
signum a
a)
fromInteger :: Integer -> Max a
fromInteger = forall a. a -> Max a
Max forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger
data Arg a b = Arg
a
b
deriving
( Int -> Arg a b -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall a b. (Show a, Show b) => Int -> Arg a b -> ShowS
forall a b. (Show a, Show b) => [Arg a b] -> ShowS
forall a b. (Show a, Show b) => Arg a b -> String
showList :: [Arg a b] -> ShowS
$cshowList :: forall a b. (Show a, Show b) => [Arg a b] -> ShowS
show :: Arg a b -> String
$cshow :: forall a b. (Show a, Show b) => Arg a b -> String
showsPrec :: Int -> Arg a b -> ShowS
$cshowsPrec :: forall a b. (Show a, Show b) => Int -> Arg a b -> ShowS
Show
, ReadPrec [Arg a b]
ReadPrec (Arg a b)
ReadS [Arg a b]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall a b. (Read a, Read b) => ReadPrec [Arg a b]
forall a b. (Read a, Read b) => ReadPrec (Arg a b)
forall a b. (Read a, Read b) => Int -> ReadS (Arg a b)
forall a b. (Read a, Read b) => ReadS [Arg a b]
readListPrec :: ReadPrec [Arg a b]
$creadListPrec :: forall a b. (Read a, Read b) => ReadPrec [Arg a b]
readPrec :: ReadPrec (Arg a b)
$creadPrec :: forall a b. (Read a, Read b) => ReadPrec (Arg a b)
readList :: ReadS [Arg a b]
$creadList :: forall a b. (Read a, Read b) => ReadS [Arg a b]
readsPrec :: Int -> ReadS (Arg a b)
$creadsPrec :: forall a b. (Read a, Read b) => Int -> ReadS (Arg a b)
Read
, Arg a b -> Constr
Arg a b -> DataType
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall {a} {b}. (Data a, Data b) => Typeable (Arg a b)
forall a b. (Data a, Data b) => Arg a b -> Constr
forall a b. (Data a, Data b) => Arg a b -> DataType
forall a b.
(Data a, Data b) =>
(forall b. Data b => b -> b) -> Arg a b -> Arg a b
forall a b u.
(Data a, Data b) =>
Int -> (forall d. Data d => d -> u) -> Arg a b -> u
forall a b u.
(Data a, Data b) =>
(forall d. Data d => d -> u) -> Arg a b -> [u]
forall a b r r'.
(Data a, Data b) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Arg a b -> r
forall a b r r'.
(Data a, Data b) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Arg a b -> r
forall a b (m :: * -> *).
(Data a, Data b, Monad m) =>
(forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b)
forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b)
forall a b (c :: * -> *).
(Data a, Data b) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Arg a b)
forall a b (c :: * -> *).
(Data a, Data b) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Arg a b -> c (Arg a b)
forall a b (t :: * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Arg a b))
forall a b (t :: * -> * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg a b))
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Arg a b)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Arg a b -> c (Arg a b)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg a b))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b)
$cgmapMo :: forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b)
$cgmapMp :: forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b)
$cgmapM :: forall a b (m :: * -> *).
(Data a, Data b, Monad m) =>
(forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Arg a b -> u
$cgmapQi :: forall a b u.
(Data a, Data b) =>
Int -> (forall d. Data d => d -> u) -> Arg a b -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Arg a b -> [u]
$cgmapQ :: forall a b u.
(Data a, Data b) =>
(forall d. Data d => d -> u) -> Arg a b -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Arg a b -> r
$cgmapQr :: forall a b r r'.
(Data a, Data b) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Arg a b -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Arg a b -> r
$cgmapQl :: forall a b r r'.
(Data a, Data b) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Arg a b -> r
gmapT :: (forall b. Data b => b -> b) -> Arg a b -> Arg a b
$cgmapT :: forall a b.
(Data a, Data b) =>
(forall b. Data b => b -> b) -> Arg a b -> Arg a b
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg a b))
$cdataCast2 :: forall a b (t :: * -> * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg a b))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Arg a b))
$cdataCast1 :: forall a b (t :: * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Arg a b))
dataTypeOf :: Arg a b -> DataType
$cdataTypeOf :: forall a b. (Data a, Data b) => Arg a b -> DataType
toConstr :: Arg a b -> Constr
$ctoConstr :: forall a b. (Data a, Data b) => Arg a b -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Arg a b)
$cgunfold :: forall a b (c :: * -> *).
(Data a, Data b) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Arg a b)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Arg a b -> c (Arg a b)
$cgfoldl :: forall a b (c :: * -> *).
(Data a, Data b) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Arg a b -> c (Arg a b)
Data
, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a b x. Rep (Arg a b) x -> Arg a b
forall a b x. Arg a b -> Rep (Arg a b) x
$cto :: forall a b x. Rep (Arg a b) x -> Arg a b
$cfrom :: forall a b x. Arg a b -> Rep (Arg a b) x
Generic
, forall a a. Rep1 (Arg a) a -> Arg a a
forall a a. Arg a a -> Rep1 (Arg a) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a a. Rep1 (Arg a) a -> Arg a a
$cfrom1 :: forall a a. Arg a a -> Rep1 (Arg a) a
Generic1
)
type ArgMin a b = Min (Arg a b)
type ArgMax a b = Max (Arg a b)
instance Functor (Arg a) where
fmap :: forall a b. (a -> b) -> Arg a a -> Arg a b
fmap a -> b
f (Arg a
x a
a) = forall a b. a -> b -> Arg a b
Arg a
x (a -> b
f a
a)
instance Foldable (Arg a) where
foldMap :: forall m a. Monoid m => (a -> m) -> Arg a a -> m
foldMap a -> m
f (Arg a
_ a
a) = a -> m
f a
a
instance Traversable (Arg a) where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Arg a a -> f (Arg a b)
traverse a -> f b
f (Arg a
x a
a) = forall a b. a -> b -> Arg a b
Arg a
x forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a
instance Eq a => Eq (Arg a b) where
Arg a
a b
_ == :: Arg a b -> Arg a b -> Bool
== Arg a
b b
_ = a
a forall a. Eq a => a -> a -> Bool
== a
b
instance Ord a => Ord (Arg a b) where
Arg a
a b
_ compare :: Arg a b -> Arg a b -> Ordering
`compare` Arg a
b b
_ = forall a. Ord a => a -> a -> Ordering
compare a
a a
b
min :: Arg a b -> Arg a b -> Arg a b
min x :: Arg a b
x@(Arg a
a b
_) y :: Arg a b
y@(Arg a
b b
_)
| a
a forall a. Ord a => a -> a -> Bool
<= a
b = Arg a b
x
| Bool
otherwise = Arg a b
y
max :: Arg a b -> Arg a b -> Arg a b
max x :: Arg a b
x@(Arg a
a b
_) y :: Arg a b
y@(Arg a
b b
_)
| a
a forall a. Ord a => a -> a -> Bool
>= a
b = Arg a b
x
| Bool
otherwise = Arg a b
y
instance Bifunctor Arg where
bimap :: forall a b c d. (a -> b) -> (c -> d) -> Arg a c -> Arg b d
bimap a -> b
f c -> d
g (Arg a
a c
b) = forall a b. a -> b -> Arg a b
Arg (a -> b
f a
a) (c -> d
g c
b)
instance Bifoldable Arg where
bifoldMap :: forall m a b. Monoid m => (a -> m) -> (b -> m) -> Arg a b -> m
bifoldMap a -> m
f b -> m
g (Arg a
a b
b) = a -> m
f a
a forall a. Semigroup a => a -> a -> a
<> b -> m
g b
b
instance Bitraversable Arg where
bitraverse :: forall (f :: * -> *) a c b d.
Applicative f =>
(a -> f c) -> (b -> f d) -> Arg a b -> f (Arg c d)
bitraverse a -> f c
f b -> f d
g (Arg a
a b
b) = forall a b. a -> b -> Arg a b
Arg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f c
f a
a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> b -> f d
g b
b
newtype First a = First { forall a. First a -> a
getFirst :: a }
deriving ( First a
forall a. a -> a -> Bounded a
forall a. Bounded a => First a
maxBound :: First a
$cmaxBound :: forall a. Bounded a => First a
minBound :: First a
$cminBound :: forall a. Bounded a => First a
Bounded
, First a -> First a -> Bool
forall a. Eq a => First a -> First a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: First a -> First a -> Bool
$c/= :: forall a. Eq a => First a -> First a -> Bool
== :: First a -> First a -> Bool
$c== :: forall a. Eq a => First a -> First a -> Bool
Eq
, First a -> First a -> Bool
First a -> First a -> Ordering
First a -> First a -> First a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (First a)
forall a. Ord a => First a -> First a -> Bool
forall a. Ord a => First a -> First a -> Ordering
forall a. Ord a => First a -> First a -> First a
min :: First a -> First a -> First a
$cmin :: forall a. Ord a => First a -> First a -> First a
max :: First a -> First a -> First a
$cmax :: forall a. Ord a => First a -> First a -> First a
>= :: First a -> First a -> Bool
$c>= :: forall a. Ord a => First a -> First a -> Bool
> :: First a -> First a -> Bool
$c> :: forall a. Ord a => First a -> First a -> Bool
<= :: First a -> First a -> Bool
$c<= :: forall a. Ord a => First a -> First a -> Bool
< :: First a -> First a -> Bool
$c< :: forall a. Ord a => First a -> First a -> Bool
compare :: First a -> First a -> Ordering
$ccompare :: forall a. Ord a => First a -> First a -> Ordering
Ord
, Int -> First a -> ShowS
forall a. Show a => Int -> First a -> ShowS
forall a. Show a => [First a] -> ShowS
forall a. Show a => First a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [First a] -> ShowS
$cshowList :: forall a. Show a => [First a] -> ShowS
show :: First a -> String
$cshow :: forall a. Show a => First a -> String
showsPrec :: Int -> First a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> First a -> ShowS
Show
, ReadPrec [First a]
ReadPrec (First a)
ReadS [First a]
forall a. Read a => ReadPrec [First a]
forall a. Read a => ReadPrec (First a)
forall a. Read a => Int -> ReadS (First a)
forall a. Read a => ReadS [First a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [First a]
$creadListPrec :: forall a. Read a => ReadPrec [First a]
readPrec :: ReadPrec (First a)
$creadPrec :: forall a. Read a => ReadPrec (First a)
readList :: ReadS [First a]
$creadList :: forall a. Read a => ReadS [First a]
readsPrec :: Int -> ReadS (First a)
$creadsPrec :: forall a. Read a => Int -> ReadS (First a)
Read
, First a -> Constr
First a -> DataType
forall {a}. Data a => Typeable (First a)
forall a. Data a => First a -> Constr
forall a. Data a => First a -> DataType
forall a.
Data a =>
(forall b. Data b => b -> b) -> First a -> First a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> First a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> First a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> First a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> First a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> First a -> m (First a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> First a -> m (First a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (First a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> First a -> c (First a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (First a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (First a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (First a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> First a -> c (First a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (First a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> First a -> m (First a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> First a -> m (First a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> First a -> m (First a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> First a -> m (First a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> First a -> m (First a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> First a -> m (First a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> First a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> First a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> First a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> First a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> First a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> First a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> First a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> First a -> r
gmapT :: (forall b. Data b => b -> b) -> First a -> First a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> First a -> First a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (First a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (First a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (First a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (First a))
dataTypeOf :: First a -> DataType
$cdataTypeOf :: forall a. Data a => First a -> DataType
toConstr :: First a -> Constr
$ctoConstr :: forall a. Data a => First a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (First a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (First a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> First a -> c (First a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> First a -> c (First a)
Data
, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (First a) x -> First a
forall a x. First a -> Rep (First a) x
$cto :: forall a x. Rep (First a) x -> First a
$cfrom :: forall a x. First a -> Rep (First a) x
Generic
, forall a. Rep1 First a -> First a
forall a. First a -> Rep1 First a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 First a -> First a
$cfrom1 :: forall a. First a -> Rep1 First a
Generic1
)
instance Enum a => Enum (First a) where
succ :: First a -> First a
succ (First a
a) = forall a. a -> First a
First (forall a. Enum a => a -> a
succ a
a)
pred :: First a -> First a
pred (First a
a) = forall a. a -> First a
First (forall a. Enum a => a -> a
pred a
a)
toEnum :: Int -> First a
toEnum = forall a. a -> First a
First forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => Int -> a
toEnum
fromEnum :: First a -> Int
fromEnum = forall a. Enum a => a -> Int
fromEnum forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. First a -> a
getFirst
enumFrom :: First a -> [First a]
enumFrom (First a
a) = forall a. a -> First a
First forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> [a]
enumFrom a
a
enumFromThen :: First a -> First a -> [First a]
enumFromThen (First a
a) (First a
b) = forall a. a -> First a
First forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromThen a
a a
b
enumFromTo :: First a -> First a -> [First a]
enumFromTo (First a
a) (First a
b) = forall a. a -> First a
First forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromTo a
a a
b
enumFromThenTo :: First a -> First a -> First a -> [First a]
enumFromThenTo (First a
a) (First a
b) (First a
c) = forall a. a -> First a
First forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo a
a a
b a
c
instance Semigroup (First a) where
First a
a <> :: First a -> First a -> First a
<> First a
_ = First a
a
stimes :: forall b. Integral b => b -> First a -> First a
stimes = forall b a. Integral b => b -> a -> a
stimesIdempotent
instance Functor First where
fmap :: forall a b. (a -> b) -> First a -> First b
fmap a -> b
f (First a
x) = forall a. a -> First a
First (a -> b
f a
x)
instance Foldable First where
foldMap :: forall m a. Monoid m => (a -> m) -> First a -> m
foldMap a -> m
f (First a
a) = a -> m
f a
a
instance Traversable First where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> First a -> f (First b)
traverse a -> f b
f (First a
a) = forall a. a -> First a
First forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a
instance Applicative First where
pure :: forall a. a -> First a
pure a
x = forall a. a -> First a
First a
x
First a
a <* :: forall a b. First a -> First b -> First a
<* First b
_ = First a
a
First a
_ *> :: forall a b. First a -> First b -> First b
*> First b
a = First b
a
<*> :: forall a b. First (a -> b) -> First a -> First b
(<*>) = coerce :: forall a b. Coercible a b => a -> b
coerce
liftA2 :: forall a b c. (a -> b -> c) -> First a -> First b -> First c
liftA2 = coerce :: forall a b. Coercible a b => a -> b
coerce
instance Monad First where
>> :: forall a b. First a -> First b -> First b
(>>) = forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
(*>)
First a
a >>= :: forall a b. First a -> (a -> First b) -> First b
>>= a -> First b
f = a -> First b
f a
a
instance MonadFix First where
mfix :: forall a. (a -> First a) -> First a
mfix a -> First a
f = forall a. (a -> a) -> a
fix (a -> First a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. First a -> a
getFirst)
newtype Last a = Last { forall a. Last a -> a
getLast :: a }
deriving ( Last a
forall a. a -> a -> Bounded a
forall a. Bounded a => Last a
maxBound :: Last a
$cmaxBound :: forall a. Bounded a => Last a
minBound :: Last a
$cminBound :: forall a. Bounded a => Last a
Bounded
, Last a -> Last a -> Bool
forall a. Eq a => Last a -> Last a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Last a -> Last a -> Bool
$c/= :: forall a. Eq a => Last a -> Last a -> Bool
== :: Last a -> Last a -> Bool
$c== :: forall a. Eq a => Last a -> Last a -> Bool
Eq
, Last a -> Last a -> Bool
Last a -> Last a -> Ordering
Last a -> Last a -> Last a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Last a)
forall a. Ord a => Last a -> Last a -> Bool
forall a. Ord a => Last a -> Last a -> Ordering
forall a. Ord a => Last a -> Last a -> Last a
min :: Last a -> Last a -> Last a
$cmin :: forall a. Ord a => Last a -> Last a -> Last a
max :: Last a -> Last a -> Last a
$cmax :: forall a. Ord a => Last a -> Last a -> Last a
>= :: Last a -> Last a -> Bool
$c>= :: forall a. Ord a => Last a -> Last a -> Bool
> :: Last a -> Last a -> Bool
$c> :: forall a. Ord a => Last a -> Last a -> Bool
<= :: Last a -> Last a -> Bool
$c<= :: forall a. Ord a => Last a -> Last a -> Bool
< :: Last a -> Last a -> Bool
$c< :: forall a. Ord a => Last a -> Last a -> Bool
compare :: Last a -> Last a -> Ordering
$ccompare :: forall a. Ord a => Last a -> Last a -> Ordering
Ord
, Int -> Last a -> ShowS
forall a. Show a => Int -> Last a -> ShowS
forall a. Show a => [Last a] -> ShowS
forall a. Show a => Last a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Last a] -> ShowS
$cshowList :: forall a. Show a => [Last a] -> ShowS
show :: Last a -> String
$cshow :: forall a. Show a => Last a -> String
showsPrec :: Int -> Last a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Last a -> ShowS
Show
, ReadPrec [Last a]
ReadPrec (Last a)
ReadS [Last a]
forall a. Read a => ReadPrec [Last a]
forall a. Read a => ReadPrec (Last a)
forall a. Read a => Int -> ReadS (Last a)
forall a. Read a => ReadS [Last a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Last a]
$creadListPrec :: forall a. Read a => ReadPrec [Last a]
readPrec :: ReadPrec (Last a)
$creadPrec :: forall a. Read a => ReadPrec (Last a)
readList :: ReadS [Last a]
$creadList :: forall a. Read a => ReadS [Last a]
readsPrec :: Int -> ReadS (Last a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Last a)
Read
, Last a -> Constr
Last a -> DataType
forall {a}. Data a => Typeable (Last a)
forall a. Data a => Last a -> Constr
forall a. Data a => Last a -> DataType
forall a.
Data a =>
(forall b. Data b => b -> b) -> Last a -> Last a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Last a -> u
forall a u. Data a => (forall d. Data d => d -> u) -> Last a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r
forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Last a -> m (Last a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Last a -> m (Last a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Last a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Last a -> c (Last a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Last a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Last a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Last a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Last a -> c (Last a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Last a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Last a -> m (Last a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Last a -> m (Last a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Last a -> m (Last a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Last a -> m (Last a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Last a -> m (Last a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Last a -> m (Last a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Last a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Last a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Last a -> [u]
$cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> Last a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r
gmapT :: (forall b. Data b => b -> b) -> Last a -> Last a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Last a -> Last a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Last a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Last a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Last a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Last a))
dataTypeOf :: Last a -> DataType
$cdataTypeOf :: forall a. Data a => Last a -> DataType
toConstr :: Last a -> Constr
$ctoConstr :: forall a. Data a => Last a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Last a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Last a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Last a -> c (Last a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Last a -> c (Last a)
Data
, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Last a) x -> Last a
forall a x. Last a -> Rep (Last a) x
$cto :: forall a x. Rep (Last a) x -> Last a
$cfrom :: forall a x. Last a -> Rep (Last a) x
Generic
, forall a. Rep1 Last a -> Last a
forall a. Last a -> Rep1 Last a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 Last a -> Last a
$cfrom1 :: forall a. Last a -> Rep1 Last a
Generic1
)
instance Enum a => Enum (Last a) where
succ :: Last a -> Last a
succ (Last a
a) = forall a. a -> Last a
Last (forall a. Enum a => a -> a
succ a
a)
pred :: Last a -> Last a
pred (Last a
a) = forall a. a -> Last a
Last (forall a. Enum a => a -> a
pred a
a)
toEnum :: Int -> Last a
toEnum = forall a. a -> Last a
Last forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => Int -> a
toEnum
fromEnum :: Last a -> Int
fromEnum = forall a. Enum a => a -> Int
fromEnum forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Last a -> a
getLast
enumFrom :: Last a -> [Last a]
enumFrom (Last a
a) = forall a. a -> Last a
Last forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> [a]
enumFrom a
a
enumFromThen :: Last a -> Last a -> [Last a]
enumFromThen (Last a
a) (Last a
b) = forall a. a -> Last a
Last forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromThen a
a a
b
enumFromTo :: Last a -> Last a -> [Last a]
enumFromTo (Last a
a) (Last a
b) = forall a. a -> Last a
Last forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromTo a
a a
b
enumFromThenTo :: Last a -> Last a -> Last a -> [Last a]
enumFromThenTo (Last a
a) (Last a
b) (Last a
c) = forall a. a -> Last a
Last forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo a
a a
b a
c
instance Semigroup (Last a) where
Last a
_ <> :: Last a -> Last a -> Last a
<> Last a
b = Last a
b
stimes :: forall b. Integral b => b -> Last a -> Last a
stimes = forall b a. Integral b => b -> a -> a
stimesIdempotent
instance Functor Last where
fmap :: forall a b. (a -> b) -> Last a -> Last b
fmap a -> b
f (Last a
x) = forall a. a -> Last a
Last (a -> b
f a
x)
a
a <$ :: forall a b. a -> Last b -> Last a
<$ Last b
_ = forall a. a -> Last a
Last a
a
instance Foldable Last where
foldMap :: forall m a. Monoid m => (a -> m) -> Last a -> m
foldMap a -> m
f (Last a
a) = a -> m
f a
a
instance Traversable Last where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Last a -> f (Last b)
traverse a -> f b
f (Last a
a) = forall a. a -> Last a
Last forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a
instance Applicative Last where
pure :: forall a. a -> Last a
pure = forall a. a -> Last a
Last
Last a
a <* :: forall a b. Last a -> Last b -> Last a
<* Last b
_ = Last a
a
Last a
_ *> :: forall a b. Last a -> Last b -> Last b
*> Last b
a = Last b
a
<*> :: forall a b. Last (a -> b) -> Last a -> Last b
(<*>) = coerce :: forall a b. Coercible a b => a -> b
coerce
liftA2 :: forall a b c. (a -> b -> c) -> Last a -> Last b -> Last c
liftA2 = coerce :: forall a b. Coercible a b => a -> b
coerce
instance Monad Last where
>> :: forall a b. Last a -> Last b -> Last b
(>>) = forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
(*>)
Last a
a >>= :: forall a b. Last a -> (a -> Last b) -> Last b
>>= a -> Last b
f = a -> Last b
f a
a
instance MonadFix Last where
mfix :: forall a. (a -> Last a) -> Last a
mfix a -> Last a
f = forall a. (a -> a) -> a
fix (a -> Last a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Last a -> a
getLast)
newtype WrappedMonoid m = WrapMonoid { forall m. WrappedMonoid m -> m
unwrapMonoid :: m }
deriving ( WrappedMonoid m
forall a. a -> a -> Bounded a
forall m. Bounded m => WrappedMonoid m
maxBound :: WrappedMonoid m
$cmaxBound :: forall m. Bounded m => WrappedMonoid m
minBound :: WrappedMonoid m
$cminBound :: forall m. Bounded m => WrappedMonoid m
Bounded
, WrappedMonoid m -> WrappedMonoid m -> Bool
forall m. Eq m => WrappedMonoid m -> WrappedMonoid m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WrappedMonoid m -> WrappedMonoid m -> Bool
$c/= :: forall m. Eq m => WrappedMonoid m -> WrappedMonoid m -> Bool
== :: WrappedMonoid m -> WrappedMonoid m -> Bool
$c== :: forall m. Eq m => WrappedMonoid m -> WrappedMonoid m -> Bool
Eq
, WrappedMonoid m -> WrappedMonoid m -> Bool
WrappedMonoid m -> WrappedMonoid m -> Ordering
WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {m}. Ord m => Eq (WrappedMonoid m)
forall m. Ord m => WrappedMonoid m -> WrappedMonoid m -> Bool
forall m. Ord m => WrappedMonoid m -> WrappedMonoid m -> Ordering
forall m.
Ord m =>
WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m
min :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m
$cmin :: forall m.
Ord m =>
WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m
max :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m
$cmax :: forall m.
Ord m =>
WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m
>= :: WrappedMonoid m -> WrappedMonoid m -> Bool
$c>= :: forall m. Ord m => WrappedMonoid m -> WrappedMonoid m -> Bool
> :: WrappedMonoid m -> WrappedMonoid m -> Bool
$c> :: forall m. Ord m => WrappedMonoid m -> WrappedMonoid m -> Bool
<= :: WrappedMonoid m -> WrappedMonoid m -> Bool
$c<= :: forall m. Ord m => WrappedMonoid m -> WrappedMonoid m -> Bool
< :: WrappedMonoid m -> WrappedMonoid m -> Bool
$c< :: forall m. Ord m => WrappedMonoid m -> WrappedMonoid m -> Bool
compare :: WrappedMonoid m -> WrappedMonoid m -> Ordering
$ccompare :: forall m. Ord m => WrappedMonoid m -> WrappedMonoid m -> Ordering
Ord
, Int -> WrappedMonoid m -> ShowS
forall m. Show m => Int -> WrappedMonoid m -> ShowS
forall m. Show m => [WrappedMonoid m] -> ShowS
forall m. Show m => WrappedMonoid m -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WrappedMonoid m] -> ShowS
$cshowList :: forall m. Show m => [WrappedMonoid m] -> ShowS
show :: WrappedMonoid m -> String
$cshow :: forall m. Show m => WrappedMonoid m -> String
showsPrec :: Int -> WrappedMonoid m -> ShowS
$cshowsPrec :: forall m. Show m => Int -> WrappedMonoid m -> ShowS
Show
, ReadPrec [WrappedMonoid m]
ReadPrec (WrappedMonoid m)
ReadS [WrappedMonoid m]
forall m. Read m => ReadPrec [WrappedMonoid m]
forall m. Read m => ReadPrec (WrappedMonoid m)
forall m. Read m => Int -> ReadS (WrappedMonoid m)
forall m. Read m => ReadS [WrappedMonoid m]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WrappedMonoid m]
$creadListPrec :: forall m. Read m => ReadPrec [WrappedMonoid m]
readPrec :: ReadPrec (WrappedMonoid m)
$creadPrec :: forall m. Read m => ReadPrec (WrappedMonoid m)
readList :: ReadS [WrappedMonoid m]
$creadList :: forall m. Read m => ReadS [WrappedMonoid m]
readsPrec :: Int -> ReadS (WrappedMonoid m)
$creadsPrec :: forall m. Read m => Int -> ReadS (WrappedMonoid m)
Read
, WrappedMonoid m -> Constr
WrappedMonoid m -> DataType
forall {m}. Data m => Typeable (WrappedMonoid m)
forall m. Data m => WrappedMonoid m -> Constr
forall m. Data m => WrappedMonoid m -> DataType
forall m.
Data m =>
(forall b. Data b => b -> b) -> WrappedMonoid m -> WrappedMonoid m
forall m u.
Data m =>
Int -> (forall d. Data d => d -> u) -> WrappedMonoid m -> u
forall m u.
Data m =>
(forall d. Data d => d -> u) -> WrappedMonoid m -> [u]
forall m r r'.
Data m =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WrappedMonoid m -> r
forall m r r'.
Data m =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WrappedMonoid m -> r
forall m (m :: * -> *).
(Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> WrappedMonoid m -> m (WrappedMonoid m)
forall m (m :: * -> *).
(Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> WrappedMonoid m -> m (WrappedMonoid m)
forall m (c :: * -> *).
Data m =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WrappedMonoid m)
forall m (c :: * -> *).
Data m =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WrappedMonoid m -> c (WrappedMonoid m)
forall m (t :: * -> *) (c :: * -> *).
(Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WrappedMonoid m))
forall m (t :: * -> * -> *) (c :: * -> *).
(Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WrappedMonoid m))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WrappedMonoid m)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WrappedMonoid m -> c (WrappedMonoid m)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (WrappedMonoid m))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WrappedMonoid m -> m (WrappedMonoid m)
$cgmapMo :: forall m (m :: * -> *).
(Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> WrappedMonoid m -> m (WrappedMonoid m)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> WrappedMonoid m -> m (WrappedMonoid m)
$cgmapMp :: forall m (m :: * -> *).
(Data m, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> WrappedMonoid m -> m (WrappedMonoid m)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> WrappedMonoid m -> m (WrappedMonoid m)
$cgmapM :: forall m (m :: * -> *).
(Data m, Monad m) =>
(forall d. Data d => d -> m d)
-> WrappedMonoid m -> m (WrappedMonoid m)
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> WrappedMonoid m -> u
$cgmapQi :: forall m u.
Data m =>
Int -> (forall d. Data d => d -> u) -> WrappedMonoid m -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> WrappedMonoid m -> [u]
$cgmapQ :: forall m u.
Data m =>
(forall d. Data d => d -> u) -> WrappedMonoid m -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WrappedMonoid m -> r
$cgmapQr :: forall m r r'.
Data m =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WrappedMonoid m -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WrappedMonoid m -> r
$cgmapQl :: forall m r r'.
Data m =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WrappedMonoid m -> r
gmapT :: (forall b. Data b => b -> b) -> WrappedMonoid m -> WrappedMonoid m
$cgmapT :: forall m.
Data m =>
(forall b. Data b => b -> b) -> WrappedMonoid m -> WrappedMonoid m
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WrappedMonoid m))
$cdataCast2 :: forall m (t :: * -> * -> *) (c :: * -> *).
(Data m, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (WrappedMonoid m))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (WrappedMonoid m))
$cdataCast1 :: forall m (t :: * -> *) (c :: * -> *).
(Data m, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (WrappedMonoid m))
dataTypeOf :: WrappedMonoid m -> DataType
$cdataTypeOf :: forall m. Data m => WrappedMonoid m -> DataType
toConstr :: WrappedMonoid m -> Constr
$ctoConstr :: forall m. Data m => WrappedMonoid m -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WrappedMonoid m)
$cgunfold :: forall m (c :: * -> *).
Data m =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (WrappedMonoid m)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WrappedMonoid m -> c (WrappedMonoid m)
$cgfoldl :: forall m (c :: * -> *).
Data m =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WrappedMonoid m -> c (WrappedMonoid m)
Data
, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall m x. Rep (WrappedMonoid m) x -> WrappedMonoid m
forall m x. WrappedMonoid m -> Rep (WrappedMonoid m) x
$cto :: forall m x. Rep (WrappedMonoid m) x -> WrappedMonoid m
$cfrom :: forall m x. WrappedMonoid m -> Rep (WrappedMonoid m) x
Generic
, forall a. Rep1 WrappedMonoid a -> WrappedMonoid a
forall a. WrappedMonoid a -> Rep1 WrappedMonoid a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 WrappedMonoid a -> WrappedMonoid a
$cfrom1 :: forall a. WrappedMonoid a -> Rep1 WrappedMonoid a
Generic1
)
instance Monoid m => Semigroup (WrappedMonoid m) where
<> :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m
(<>) = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Monoid a => a -> a -> a
mappend :: m -> m -> m)
instance Monoid m => Monoid (WrappedMonoid m) where
mempty :: WrappedMonoid m
mempty = forall m. m -> WrappedMonoid m
WrapMonoid forall a. Monoid a => a
mempty
instance Enum a => Enum (WrappedMonoid a) where
succ :: WrappedMonoid a -> WrappedMonoid a
succ (WrapMonoid a
a) = forall m. m -> WrappedMonoid m
WrapMonoid (forall a. Enum a => a -> a
succ a
a)
pred :: WrappedMonoid a -> WrappedMonoid a
pred (WrapMonoid a
a) = forall m. m -> WrappedMonoid m
WrapMonoid (forall a. Enum a => a -> a
pred a
a)
toEnum :: Int -> WrappedMonoid a
toEnum = forall m. m -> WrappedMonoid m
WrapMonoid forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => Int -> a
toEnum
fromEnum :: WrappedMonoid a -> Int
fromEnum = forall a. Enum a => a -> Int
fromEnum forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall m. WrappedMonoid m -> m
unwrapMonoid
enumFrom :: WrappedMonoid a -> [WrappedMonoid a]
enumFrom (WrapMonoid a
a) = forall m. m -> WrappedMonoid m
WrapMonoid forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> [a]
enumFrom a
a
enumFromThen :: WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a]
enumFromThen (WrapMonoid a
a) (WrapMonoid a
b) = forall m. m -> WrappedMonoid m
WrapMonoid forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromThen a
a a
b
enumFromTo :: WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a]
enumFromTo (WrapMonoid a
a) (WrapMonoid a
b) = forall m. m -> WrappedMonoid m
WrapMonoid forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> [a]
enumFromTo a
a a
b
enumFromThenTo :: WrappedMonoid a
-> WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a]
enumFromThenTo (WrapMonoid a
a) (WrapMonoid a
b) (WrapMonoid a
c) =
forall m. m -> WrappedMonoid m
WrapMonoid forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo a
a a
b a
c
mtimesDefault :: (Integral b, Monoid a) => b -> a -> a
mtimesDefault :: forall b a. (Integral b, Monoid a) => b -> a -> a
mtimesDefault b
n a
x
| b
n forall a. Eq a => a -> a -> Bool
== b
0 = forall a. Monoid a => a
mempty
| Bool
otherwise = forall m. WrappedMonoid m -> m
unwrapMonoid (forall a b. (Semigroup a, Integral b) => b -> a -> a
stimes b
n (forall m. m -> WrappedMonoid m
WrapMonoid a
x))