The Eff monad provides the implementation of a computation that performs
an arbitrary set of effects. In Eff es a, es is a type-level list that
contains all the effects that the computation may perform. For example, a
computation that produces an Integer by consuming a String from the
global environment and acting upon a single mutable value of type Bool
would have the following type:
(Reader String :> es, State Bool :> es) => Eff es Integer
Abstracting over the list of effects with (:>):
Allows the computation to be used in functions that may perform other effects.
Allows the effects to be handled in any order.
Instances23MonadError, MonadReader, MonadState, MonadWriter, MonadBase, MonadBaseControl, …
(Show e, Error e :> es, MonadError e (Eff es)) => MonadError e (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.Effect.Dynamic · orphanInstance included for compatibility with existing code.
(Reader r :> es, MonadReader r (Eff es)) => MonadReader r (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.Effect.Dynamic · orphanInstance included for compatibility with existing code.
(State s :> es, MonadState s (Eff es)) => MonadState s (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.Effect.Dynamic · orphanInstance included for compatibility with existing code.
(Monoid w, Writer w :> es, MonadWriter w (Eff es)) => MonadWriter w (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.Effect.Dynamic · orphanIOE :> es => MonadBase IO (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadInstance included for compatibility with existing code.
Usage of liftIO is preferrable as it's a standard.
IOE :> es => MonadBaseControl IO (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadInstance included for compatibility with existing code.
Usage of withEffToIO is preferrable as it allows specifying the UnliftStrategy on a case-by-case basis and has better error reporting.
Note: the unlifting strategy for liftBaseWith is taken from the IOE context (see unliftStrategy).
Monad (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadFunctor (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadMonadFix (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadFail :> es => MonadFail (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadApplicative (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadNonDet :> es => Alternative (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadNonDet :> es => MonadPlus (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadIOE :> es => MonadIO (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadMonadCatch (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadAvailable without any effect requirements.
This is the one instance of the three that would arguably benefit from requiring IOE (or a more specialized effect), as catching imprecise exceptions makes it possible to write non-deterministic pure functions with runPureEff. Unfortunately it can't, because MonadCatch is a superclass of MonadMask, which needs to be available unconditionally (see the note there).
For the full discussion see issue #76.
MonadMask (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadAvailable without any effect requirements.
This makes it possible to use cleanup functions such as bracket or finally anywhere, e.g. to restore a state on error:
transactionally :: forall s es a. State s :> es => Eff es a -> Eff es a transactionally = bracketOnError (get @s) (put @s) . constRequiring IOE would make functions like the above impossible to write and force IOE to show up in application code that otherwise only needs more restricted effects, which would be a significant usability regression. On the other hand, requiring a more specialized effect would be annoying, since functions making use of MonadMask are ubiquitous.
MonadThrow (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadPrim :> es => PrimMonad (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadIOE :> es => MonadUnliftIO (Eff es)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadInstance included for compatibility with existing code.
Usage of withEffToIO is preferrable as it allows specifying the UnliftStrategy on a case-by-case basis and has better error reporting.
Note: the unlifting strategy for withRunInIO is taken from the IOE context (see unliftStrategy).
Semigroup a => Semigroup (Eff es a)Defined in effectful-core-2.7.1.2 · Effectful.Internal.MonadMonoid a => Monoid (Eff es a)Defined in effectful-core-2.7.1.2 · Effectful.Internal.Monadtype PrimState (Eff es) = PrimStateEffDefined in effectful-core-2.7.1.2 · Effectful.Internal.Monadtype StM (Eff es) a = aDefined in effectful-core-2.7.1.2 · Effectful.Internal.Monad