@@ -59,6 +59,30 @@ import Effectful.Internal.Env
5959
6060type role Eff nominal representational
6161
62+-- | The 'Eff' monad provides the implementation of an operation that performs
63+-- an arbitrary set of effects. In @'Eff' es a@, @es@ is a type-level list that
64+-- contains all the effects that the operation may perform. For example, an
65+-- operation that produces an 'Integer' by consuming a 'String' from the global
66+-- environment and acting upon a single mutable cell containing a 'Bool' would
67+-- have the following type:
68+--
69+-- @
70+-- 'Eff' '['Effectful.Reader.Reader' 'String', 'Effectful.State.State' 'Bool'] 'Integer'
71+-- @
72+--
73+-- Normally, a concrete list of effects is not used to parameterize 'Eff'.
74+-- Instead, the '(:>)' class is used to express constraints on the list of
75+-- effects without coupling an operation to a concrete list of effects. For
76+-- example, the above example would more commonly be expressed with the
77+-- following type:
78+--
79+-- @
80+-- ('Effectful.Reader.Reader' 'String' ':>' es, 'Effectful.State.State' 'Bool' ':>' es) => 'Eff' es 'Integer'
81+-- @
82+--
83+-- This abstraction allows the operation to be used in functions that may
84+-- perform other effects, and it also allows the effects to be handled in any
85+-- order.
6286newtype Eff (es :: [Effect]) a = Eff (Env es -> IO a)
6387
6488-- | Run a pure 'Eff' operation.
@@ -220,12 +244,12 @@ tryFailIO tag m =
220244----------------------------------------
221245-- IO
222246
223−-- | Run 'IO' operations via 'MonadIO', 'MonadBaseControl' 'IO' and
224−-- 'MonadUnliftIO' classes.
247+-- | Run arbitrary 'IO' operations via 'MonadIO', 'MonadBaseControl' 'IO' or
248+-- 'MonadUnliftIO'.
225249data IOE :: Effect where
226250 IOE :: IOE m r
227251
228−-- | Run an impure 'Eff' operation.
252+-- | Run an 'Eff' operation with side effects.
229253--
230254-- For the pure version see 'runEff'.
231255runIOE :: Eff '[IOE] a -> IO a