Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- (&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
- (***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c')
- type (:->) f g = forall n. f n -> g n
- (<.>) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
- data ((f :: k -> Type) :*: (g :: k -> Type)) (p :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type = (f p) :*: (g p)
- type Delta f = f :*: f
- curry' :: ((f :*: g) x -> a) -> f x -> g x -> a
- uncurry' :: (f x -> g x -> a) -> (f :*: g) x -> a
- delta :: f :-> Delta f
- deltaMap :: (f :-> g) -> Delta f :-> Delta g
- data Sum (f :: k -> Type) (g :: k -> Type) (a :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type
- either' :: (f :-> r) -> (g :-> r) -> Sum f g :-> r
- either'' :: (forall x. f x -> a) -> (forall y. g y -> a) -> Sum f g r -> a
- class c => d => Implies c d
- class Trivial c
- class EqHO (f :: ki -> *) where
- class ShowHO (f :: ki -> *) where
- showHO :: forall k. f k -> String
- showsPrecHO :: forall k. Int -> f k -> ShowS
- data Exists (f :: k -> *) :: * where
- exMap :: (forall x. f x -> g x) -> Exists f -> Exists g
- exMapM :: Monad m => (forall x. f x -> m (g x)) -> Exists f -> m (Exists g)
- exElim :: (forall x. f x -> a) -> Exists f -> a
- type Elem a as = (IsElem a as ~ True, HasElem a as)
- type NotElem a as = IsElem a as ~ False
- class HasElem a as where
- data ElemPrf a as where
- type family IsElem (a :: k) (as :: [k]) :: Bool where ...
- sameTy :: forall fam x y. (Elem x fam, Elem y fam) => Proxy fam -> Proxy x -> Proxy y -> Maybe (x :~: y)
- type family All (c :: k -> Constraint) (xs :: [k]) :: Constraint where ...
- data Witness c x where
- witness :: forall x xs c. (HasElem x xs, All c xs) => Proxy xs -> Witness c x
- witnessPrf :: All c xs => ElemPrf x xs -> Witness c x
- weq :: forall x xs. (All Eq xs, Elem x xs) => Proxy xs -> x -> x -> Bool
- wshow :: forall x xs. (All Show xs, Elem x xs) => Proxy xs -> x -> String
Utility Functions and Types
(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c') infixr 3 #
Fanout: send the input to both argument arrows and combine their output.
The default definition may be overridden with a more efficient version if desired.
(***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c') infixr 3 #
Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.
The default definition may be overridden with a more efficient version if desired.
Poly-kind indexed product functionality
data ((f :: k -> Type) :*: (g :: k -> Type)) (p :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type infixr 6 #
Products: encode multiple arguments to constructors
(f p) :*: (g p) infixr 6 |
Instances
(GDeep kappa fam f, GDeep kappa fam g) => GDeep kappa fam (f :*: g :: k -> Type) Source # | |
Generic1 (f :*: g :: k -> Type) | |
(GNFData arity a, GNFData arity b) => GNFData arity (a :*: b) | |
Defined in Control.DeepSeq | |
(ShowHO f, ShowHO g) => ShowHO (f :*: g :: ki -> Type) Source # | |
(EqHO f, EqHO g) => EqHO (f :*: g :: ki -> Type) Source # | |
(GShallow f, GShallow g) => GShallow (f :*: g :: k -> Type) Source # | |
(Monad f, Monad g) => Monad (f :*: g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :*: g) | Since: base-4.9.0.0 |
(MonadFix f, MonadFix g) => MonadFix (f :*: g) | Since: base-4.9.0.0 |
Defined in Control.Monad.Fix | |
(Applicative f, Applicative g) => Applicative (f :*: g) | Since: base-4.9.0.0 |
(Foldable f, Foldable g) => Foldable (f :*: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => (f :*: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldr1 :: (a -> a -> a) -> (f :*: g) a -> a # foldl1 :: (a -> a -> a) -> (f :*: g) a -> a # toList :: (f :*: g) a -> [a] # length :: (f :*: g) a -> Int # elem :: Eq a => a -> (f :*: g) a -> Bool # maximum :: Ord a => (f :*: g) a -> a # minimum :: Ord a => (f :*: g) a -> a # | |
(Traversable f, Traversable g) => Traversable (f :*: g) | Since: base-4.9.0.0 |
(Alternative f, Alternative g) => Alternative (f :*: g) | Since: base-4.9.0.0 |
(MonadPlus f, MonadPlus g) => MonadPlus (f :*: g) | Since: base-4.9.0.0 |
(GShallow1 f, GShallow1 g) => GShallow1 (f :*: g) Source # | |
(Eq (f p), Eq (g p)) => Eq ((f :*: g) p) | Since: base-4.7.0.0 |
(Ord (f p), Ord (g p)) => Ord ((f :*: g) p) | Since: base-4.7.0.0 |
(Read (f p), Read (g p)) => Read ((f :*: g) p) | Since: base-4.7.0.0 |
(Show (f p), Show (g p)) => Show ((f :*: g) p) | Since: base-4.7.0.0 |
Generic ((f :*: g) p) | |
(Semigroup (f p), Semigroup (g p)) => Semigroup ((f :*: g) p) | Since: base-4.12.0.0 |
(Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) | Since: base-4.12.0.0 |
type Rep1 (f :*: g :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics type Rep1 (f :*: g :: k -> Type) = D1 (MetaData ":*:" "GHC.Generics" "base" False) (C1 (MetaCons ":*:" (InfixI RightAssociative 6) False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 f) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 g))) | |
type Rep ((f :*: g) p) | Since: base-4.7.0.0 |
Defined in GHC.Generics type Rep ((f :*: g) p) = D1 (MetaData ":*:" "GHC.Generics" "base" False) (C1 (MetaCons ":*:" (InfixI RightAssociative 6) False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (f p)) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (g p)))) |
deltaMap :: (f :-> g) -> Delta f :-> Delta g Source #
Applies the same function to both components of the pair
Poly-kind indexed sums
data Sum (f :: k -> Type) (g :: k -> Type) (a :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type #
Lifted sum of functors.
Instances
Generic1 (Sum f g :: k -> Type) | |
(ShowHO f, ShowHO g) => ShowHO (Sum f g :: ki -> Type) Source # | |
(EqHO f, EqHO g) => EqHO (Sum f g :: ki -> Type) Source # | |
(Functor f, Functor g) => Functor (Sum f g) | Since: base-4.9.0.0 |
(Foldable f, Foldable g) => Foldable (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum fold :: Monoid m => Sum f g m -> m # foldMap :: Monoid m => (a -> m) -> Sum f g a -> m # foldr :: (a -> b -> b) -> b -> Sum f g a -> b # foldr' :: (a -> b -> b) -> b -> Sum f g a -> b # foldl :: (b -> a -> b) -> b -> Sum f g a -> b # foldl' :: (b -> a -> b) -> b -> Sum f g a -> b # foldr1 :: (a -> a -> a) -> Sum f g a -> a # foldl1 :: (a -> a -> a) -> Sum f g a -> a # elem :: Eq a => a -> Sum f g a -> Bool # maximum :: Ord a => Sum f g a -> a # minimum :: Ord a => Sum f g a -> a # | |
(Traversable f, Traversable g) => Traversable (Sum f g) | Since: base-4.9.0.0 |
(Eq1 f, Eq1 g) => Eq1 (Sum f g) | Since: base-4.9.0.0 |
(Ord1 f, Ord1 g) => Ord1 (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum | |
(Read1 f, Read1 g) => Read1 (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum | |
(Show1 f, Show1 g) => Show1 (Sum f g) | Since: base-4.9.0.0 |
(NFData1 f, NFData1 g) => NFData1 (Sum f g) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
(Eq1 f, Eq1 g, Eq a) => Eq (Sum f g a) | Since: base-4.9.0.0 |
(Typeable a, Typeable f, Typeable g, Typeable k, Data (f a), Data (g a)) => Data (Sum f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> Sum f g a -> c (Sum f g a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Sum f g a) # toConstr :: Sum f g a -> Constr # dataTypeOf :: Sum f g a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Sum f g a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Sum f g a)) # gmapT :: (forall b. Data b => b -> b) -> Sum f g a -> Sum f g a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Sum f g a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Sum f g a -> r # gmapQ :: (forall d. Data d => d -> u) -> Sum f g a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Sum f g a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Sum f g a -> m (Sum f g a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum f g a -> m (Sum f g a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum f g a -> m (Sum f g a) # | |
(Ord1 f, Ord1 g, Ord a) => Ord (Sum f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum | |
(Read1 f, Read1 g, Read a) => Read (Sum f g a) | Since: base-4.9.0.0 |
(Show1 f, Show1 g, Show a) => Show (Sum f g a) | Since: base-4.9.0.0 |
Generic (Sum f g a) | |
(NFData1 f, NFData1 g, NFData a) => NFData (Sum f g a) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
type Rep1 (Sum f g :: k -> Type) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum type Rep1 (Sum f g :: k -> Type) = D1 (MetaData "Sum" "Data.Functor.Sum" "base" False) (C1 (MetaCons "InL" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 f)) :+: C1 (MetaCons "InR" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 g))) | |
type Rep (Sum f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum type Rep (Sum f g a) = D1 (MetaData "Sum" "Data.Functor.Sum" "base" False) (C1 (MetaCons "InL" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (f a))) :+: C1 (MetaCons "InR" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (g a)))) |
either'' :: (forall x. f x -> a) -> (forall y. g y -> a) -> Sum f g r -> a Source #
Just like either'
, but the result type is of kind Star
Constraints
class c => d => Implies c d Source #
Constraint implication
Instances
c -> d => Implies c d Source # | |
Defined in Generics.Simplistic.Util |
Trivial constraint
Instances
Trivial (c :: k) Source # | |
Defined in Generics.Simplistic.Util |
Higher-order Eq and Show
class EqHO (f :: ki -> *) where Source #
Higher order , poly kinded, version of Eq
Instances
EqHO (U1 :: ki -> Type) Source # | |
EqHO (V1 :: ki -> Type) Source # | |
Eq a => EqHO (Const a :: ki -> Type) Source # | |
(EqHO f, EqHO g) => EqHO (Sum f g :: ki -> Type) Source # | |
(EqHO f, EqHO g) => EqHO (f :*: g :: ki -> Type) Source # | |
(All Eq kappa, EqHO h) => EqHO (Holes kappa fam h :: Type -> Type) Source # | |
class ShowHO (f :: ki -> *) where Source #
Higher order, poly kinded, version of Show
; We provide
the same showsPrec
mechanism. The documentation of Text.Show
has a good example of the correct usage of showsPrec
:
infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a instance (Show a) => Show (Tree a) where showsPrec d (Leaf m) = showParen (d > app_prec) $ showString "Leaf " . showsPrec (app_prec+1) m where app_prec = 10 showsPrec d (u :^: v) = showParen (d > up_prec) $ showsPrec (up_prec+1) u . showString " :^: " . showsPrec (up_prec+1) v where up_prec = 5
Existential Wrapper
data Exists (f :: k -> *) :: * where Source #
Existential type wrapper. This comesin particularly handy when we want to add mrsop terms to some container. See Generics.MRSOP.Holes.Unify for example.
exMapM :: Monad m => (forall x. f x -> m (g x)) -> Exists f -> m (Exists g) Source #
Maps a monadic actino over Exists
Elem functionality
type Elem a as = (IsElem a as ~ True, HasElem a as) Source #
We will carry constructive information on the
constraint. Forcing IsElem
to true
sameTy :: forall fam x y. (Elem x fam, Elem y fam) => Proxy fam -> Proxy x -> Proxy y -> Maybe (x :~: y) Source #
Returns whether two types are the same, given that both belong to the same list.
Witnessing and All constraints
type family All (c :: k -> Constraint) (xs :: [k]) :: Constraint where ... Source #
witness :: forall x xs c. (HasElem x xs, All c xs) => Proxy xs -> Witness c x Source #
Provides the witness that x
is an instance of c
witnessPrf :: All c xs => ElemPrf x xs -> Witness c x Source #
Provides the witness that x
is an instance of c