Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Operations on sums, combining effects into a signature.
Since: 0.1.0.0
Synopsis
- class Member (sub :: (Type -> Type) -> Type -> Type) (sup :: (Type -> Type) -> Type -> Type) where
- type family Members (sub :: (Type -> Type) -> Type -> Type) (sup :: (Type -> Type) -> Type -> Type) where ...
- data ((f :: (Type -> Type) -> Type -> Type) :+: (g :: (Type -> Type) -> Type -> Type)) (m :: Type -> Type) k
- reassociateSumL :: forall (l1 :: (Type -> Type) -> Type -> Type) (l2 :: (Type -> Type) -> Type -> Type) (r :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) a. (l1 :+: (l2 :+: r)) m a -> ((l1 :+: l2) :+: r) m a
Membership
class Member (sub :: (Type -> Type) -> Type -> Type) (sup :: (Type -> Type) -> Type -> Type) where Source #
The class of types present in a signature.
This is based on Wouter Swierstra’s design described in Data types à la carte. As described therein, overlapping instances are required in order to distinguish e.g. left-occurrence from right-recursion.
It should not generally be necessary for you to define new Member
instances, but these are not specifically prohibited if you wish to get creative.
Since: 0.1.0.0
inj :: forall (m :: Type -> Type) a. sub m a -> sup m a Source #
Inject a member of a signature into the signature.
Instances
Member t t Source # | Reflexivity: |
Member l (l :+: r) Source # | Left-occurrence: if |
Member l r => Member l (l' :+: r) Source # | Right-recursion: if |
Member t (l1 :+: (l2 :+: r)) => Member t ((l1 :+: l2) :+: r) Source # | Left-recursion: if |
type family Members (sub :: (Type -> Type) -> Type -> Type) (sup :: (Type -> Type) -> Type -> Type) where ... Source #
Decompose sums on the left into multiple Member
constraints.
Note that while this, and by extension Has
, can be used to group together multiple membership checks into a single (composite) constraint, large signatures on the left can slow compiles down due to a problem with recursive type families.
Since: 1.0.0.0
Sums
data ((f :: (Type -> Type) -> Type -> Type) :+: (g :: (Type -> Type) -> Type -> Type)) (m :: Type -> Type) k infixr 4 Source #
Higher-order sums are used to combine multiple effects into a signature, typically by chaining on the right.
Instances
Algebra NonDet [] Source # | |
LabelledMember (label :: k) l (Labelled label l :+: r) Source # | Left-occurrence: if |
Defined in Control.Effect.Labelled | |
LabelledMember label l r => LabelledMember (label :: k) l (l' :+: r) Source # | Right-recursion: if |
Defined in Control.Effect.Labelled | |
LabelledMember label t (l1 :+: (l2 :+: r)) => LabelledMember (label :: k) t ((l1 :+: l2) :+: r) Source # | Left-recursion: if |
Defined in Control.Effect.Labelled | |
Member l (l :+: r) Source # | Left-occurrence: if |
Member l r => Member l (l' :+: r) Source # | Right-recursion: if |
Member t (l1 :+: (l2 :+: r)) => Member t ((l1 :+: l2) :+: r) Source # | Left-recursion: if |
Algebra (Error e) (Either e) Source # | |
Algebra sig m => Algebra (Choose :+: sig) (ChooseC m) Source # | |
Algebra sig m => Algebra (Cull :+: (NonDet :+: sig)) (CullC m) Source # | |
Algebra sig m => Algebra (Cut :+: (NonDet :+: sig)) (CutC m) Source # | |
Algebra sig m => Algebra (Empty :+: sig) (EmptyC m) Source # | |
Algebra sig m => Algebra (Empty :+: sig) (EmptyC m) Source # | |
Algebra sig m => Algebra (Empty :+: sig) (MaybeT m) Source # | |
Algebra sig m => Algebra (Fail :+: sig) (FailC m) Source # | |
Algebra sig m => Algebra (Fresh :+: sig) (FreshC m) Source # | |
Algebra sig m => Algebra (Fresh :+: sig) (FreshC m) Source # | |
Algebra sig m => Algebra (NonDet :+: sig) (NonDetC m) Source # | |
Algebra sig m => Algebra (Trace :+: sig) (TraceC m) Source # | |
(MonadIO m, Algebra sig m) => Algebra (Trace :+: sig) (TraceC m) Source # | |
Algebra sig m => Algebra (Trace :+: sig) (TraceC m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Accum w :+: sig) (AccumC w m) Source # | |
(Algebra sig m, Semigroup w, MonadIO m) => Algebra (Accum w :+: sig) (AccumC w m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Accum w :+: sig) (AccumC w m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Accum w :+: sig) (AccumT w m) Source # | |
Algebra sig m => Algebra (Error e :+: sig) (ErrorC e m) Source # | |
Algebra sig m => Algebra (Error e :+: sig) (ErrorC e m) Source # | |
Algebra sig m => Algebra (Error e :+: sig) (ExceptT e m) Source # | |
Algebra sig m => Algebra (Reader r :+: sig) (ReaderC r m) Source # | |
Algebra sig m => Algebra (Reader r :+: sig) (ReaderT r m) Source # | |
Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # | |
(MonadIO m, Algebra sig m) => Algebra (State s :+: sig) (StateC s m) Source # | |
Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # | |
Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # | |
Algebra sig m => Algebra (State s :+: sig) (StateT s m) Source # | |
Algebra sig m => Algebra (State s :+: sig) (StateT s m) Source # | |
Algebra sig m => Algebra (Throw e :+: sig) (ThrowC e m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterC w m) Source # | |
(Monoid w, Algebra sig m) => Algebra (Writer w :+: sig) (WriterC w m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterT w m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterT w m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterT w m) Source # | |
(Reifies s (Interpreter eff m), Algebra sig m) => Algebra (eff :+: sig) (InterpretC s eff m) Source # | |
Defined in Control.Carrier.Interpret alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (InterpretC s eff m) -> (eff :+: sig) n a -> ctx () -> InterpretC s eff m (ctx a) Source # | |
Algebra (eff :+: sig) (sub m) => Algebra (Labelled label eff :+: sig) (Labelled label sub m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) Source # | |
(Algebra sig m, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) Source # | |
(LabelledMember label sub sig, Algebra sig m) => Algebra (sub :+: sig) (UnderLabel label sub m) Source # | |
Defined in Control.Effect.Labelled alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (UnderLabel label sub m) -> (sub :+: sig) n a -> ctx () -> UnderLabel label sub m (ctx a) Source # | |
(Functor (f m), Functor (g m)) => Functor ((f :+: g) m) Source # | |
(Foldable (f m), Foldable (g m)) => Foldable ((f :+: g) m) Source # | |
Defined in Control.Effect.Sum fold :: Monoid m0 => (f :+: g) m m0 -> m0 # foldMap :: Monoid m0 => (a -> m0) -> (f :+: g) m a -> m0 # foldMap' :: Monoid m0 => (a -> m0) -> (f :+: g) m a -> m0 # foldr :: (a -> b -> b) -> b -> (f :+: g) m a -> b # foldr' :: (a -> b -> b) -> b -> (f :+: g) m a -> b # foldl :: (b -> a -> b) -> b -> (f :+: g) m a -> b # foldl' :: (b -> a -> b) -> b -> (f :+: g) m a -> b # foldr1 :: (a -> a -> a) -> (f :+: g) m a -> a # foldl1 :: (a -> a -> a) -> (f :+: g) m a -> a # toList :: (f :+: g) m a -> [a] # null :: (f :+: g) m a -> Bool # length :: (f :+: g) m a -> Int # elem :: Eq a => a -> (f :+: g) m a -> Bool # maximum :: Ord a => (f :+: g) m a -> a # minimum :: Ord a => (f :+: g) m a -> a # | |
(Traversable (f m), Traversable (g m)) => Traversable ((f :+: g) m) Source # | |
Defined in Control.Effect.Sum | |
(Show (f m k), Show (g m k)) => Show ((f :+: g) m k) Source # | |
(Eq (f m k), Eq (g m k)) => Eq ((f :+: g) m k) Source # | |
(Ord (f m k), Ord (g m k)) => Ord ((f :+: g) m k) Source # | |
Defined in Control.Effect.Sum compare :: (f :+: g) m k -> (f :+: g) m k -> Ordering # (<) :: (f :+: g) m k -> (f :+: g) m k -> Bool # (<=) :: (f :+: g) m k -> (f :+: g) m k -> Bool # (>) :: (f :+: g) m k -> (f :+: g) m k -> Bool # (>=) :: (f :+: g) m k -> (f :+: g) m k -> Bool # |