on master help sign in
Haddock improvements
3294d3bAndrzej Rybczak
effectful-core/src/Effectful/Error.hs+3−4
@@ -6,8 +6,8 @@
6-- exceptions, that's what functions from the @exceptions@ library are for (see
6-- exceptions, that's what functions from the @exceptions@ library are for (see
7-- "Control.Monad.Catch" for more information).
7-- "Control.Monad.Catch" for more information).
8--
8--
9−-- In particular, exceptions of type @e@ are distinct from errors of type @e@
9+-- In particular, regular exceptions of type @e@ are distinct from errors of
10−-- and will __not__ be caught by functions from this module:
10+-- type @e@ and will __not__ be caught by functions from this module:
11--
11--
12-- >>> import qualified Control.Monad.Catch as E
12-- >>> import qualified Control.Monad.Catch as E
13-- >>> let boom = error "BOOM!"
13-- >>> let boom = error "BOOM!"
@@ -38,8 +38,7 @@
38-- Left "oops"
38-- Left "oops"
39--
39--
40module Effectful.Error
40module Effectful.Error
41− ( -- * The effect
42− Error
41+ ( Error
43 , runError
42 , runError
44 , throwError
43 , throwError
45 , catchError
44 , catchError
effectful-core/src/Effectful/Internal/Effect.hs+6−6
@@ -27,13 +27,13 @@ type Effect = (Type -> Type) -> Type -> Type
27newtype IdE :: Effect -> Type where
27newtype IdE :: Effect -> Type where
28 IdE :: (forall m r. e m r) -> IdE e
28 IdE :: (forall m r. e m r) -> IdE e
29
29
30−-- | A constraint that requires that a particular effect, @e@, is a member of
30+-- | A constraint that requires that a particular effect @e@ is a member of the
31−-- the type-level list @es@. This is used to parameterize an
31+-- type-level list @es@. This is used to parameterize an 'Effectful.Monad.Eff'
32−-- 'Effectful.Monad.Eff' operation over an arbitrary list of effects, so long as
32+-- operation over an arbitrary list of effects, so long as @e@ is /somewhere/ in
33−-- @e@ is /somewhere/ in the list.
33+-- the list.
34--
34--
35−-- For example, an operation that only needs access to a cell of mutable state
35+-- For example, an operation that only needs access to a mutable value of type
36−-- containing an 'Integer' would likely use the following type:
36+-- 'Integer' would likely use the following type:
37--
37--
38-- @
38-- @
39-- 'Effectful.State.State' 'Integer' ':>' es => 'Effectful.Monad.Eff' es ()
39-- 'Effectful.State.State' 'Integer' ':>' es => 'Effectful.Monad.Eff' es ()
effectful-core/src/Effectful/Internal/Monad.hs+2−2
@@ -88,8 +88,8 @@ type role Eff nominal representational
88-- an arbitrary set of effects. In @'Eff' es a@, @es@ is a type-level list that
88-- an arbitrary set of effects. In @'Eff' es a@, @es@ is a type-level list that
89-- contains all the effects that the operation may perform. For example, an
89-- contains all the effects that the operation may perform. For example, an
90-- operation that produces an 'Integer' by consuming a 'String' from the global
90-- operation that produces an 'Integer' by consuming a 'String' from the global
91−-- environment and acting upon a single mutable cell containing a 'Bool' would
91+-- environment and acting upon a single mutable value of type 'Bool' would have
92−-- have the following type:
92+-- the following type:
93--
93--
94-- @
94-- @
95-- 'Eff' '['Effectful.Reader.Reader' 'String', 'Effectful.State.State' 'Bool'] 'Integer'
95-- 'Eff' '['Effectful.Reader.Reader' 'String', 'Effectful.State.State' 'Bool'] 'Integer'
effectful-core/src/Effectful/Internal/Unlift.hs+3−2
@@ -35,8 +35,9 @@ import Effectful.Internal.Utils
35----------------------------------------
35----------------------------------------
36-- Unlift strategies
36-- Unlift strategies
37
37
38−-- | The strategy to use when unlifting 'Eff' operations via 'withRunInIO' or
38+-- | The strategy to use when unlifting 'Eff' operations via 'withRunInIO',
39−-- the 'Effectful.Interpreter.localUnlift' family.
39+-- 'Effectful.Monad.withEffToIO' or the 'Effectful.Dispatch.Dynamic.localUnlift'
40+-- family.
40data UnliftStrategy
41data UnliftStrategy
41 = SeqUnlift
42 = SeqUnlift
42 -- ^ The fastest strategy and a default setting for 'IOE'. An attempt to call
43 -- ^ The fastest strategy and a default setting for 'IOE'. An attempt to call
effectful-core/src/Effectful/Reader.hs+1−1
@@ -1,4 +1,4 @@
1−-- | The 'Reader' effect.
1+-- | Support for access to a read only value of a particular type.
2module Effectful.Reader
2module Effectful.Reader
3 ( Reader
3 ( Reader
4 , runReader
4 , runReader
effectful-core/src/Effectful/State/Dynamic.hs+1−1
@@ -27,7 +27,7 @@ import Effectful.Monad
27import qualified Effectful.State.Local as L
27import qualified Effectful.State.Local as L
28import qualified Effectful.State.Shared as S
28import qualified Effectful.State.Shared as S
29
29
30−-- | Provide access to a mutable state of type @s@.
30+-- | Provide access to a mutable value of type @s@.
31data State s :: Effect where
31data State s :: Effect where
32 Get :: State s m s
32 Get :: State s m s
33 Put :: s -> State s m ()
33 Put :: s -> State s m ()
effectful-core/src/Effectful/State/Local.hs+3−5
@@ -1,8 +1,6 @@
1−-- | The 'State' effect.
1+-- | Support for access to a mutable value of a particular type, which is:
2--
2--
3−-- Represented as a pure value underneath, therefore:
4−--
5−-- - thread local (if you need the state to be shared between threads, have a
3+-- - thread local (if you want the value to be shared between threads, have a
6-- look at "Effectful.State.Shared"),
4-- look at "Effectful.State.Shared"),
7--
5--
8-- - very fast.
6-- - very fast.
@@ -24,7 +22,7 @@ module Effectful.State.Local
24import Effectful.Dispatch.Static
22import Effectful.Dispatch.Static
25import Effectful.Monad
23import Effectful.Monad
26
24
27−-- | Provide access to a strict (WHNF), thread local, mutable state of type @s@.
25+-- | Provide access to a strict (WHNF), thread local, mutable value of type @s@.
28newtype State s :: Effect where
26newtype State s :: Effect where
29 State :: s -> State s m r
27 State :: s -> State s m r
30
28
effectful-core/src/Effectful/State/Shared.hs+4−5
@@ -1,8 +1,7 @@
1−-- | The 'State' effect.
1+-- | Support for access to a mutable value of a particular type, which is:
2--
2--
3−-- Represented as an 'MVar' underneath, therefore:
4−--
5−-- - shareable between multiple threads,
3+-- - shareable between multiple threads (if you want each thead to manage their
4+-- own version of the value, see "Effectful.State.Local").
6--
5--
7-- - slower than "Effectful.State.Local".
6-- - slower than "Effectful.State.Local".
8--
7--
@@ -25,7 +24,7 @@ import Control.Concurrent.MVar
25import Effectful.Dispatch.Static
24import Effectful.Dispatch.Static
26import Effectful.Monad
25import Effectful.Monad
27
26
28−-- | Provide access to a strict (WHNF), shareable, mutable state of type @s@.
27+-- | Provide access to a strict (WHNF), shareable, mutable value of type @s@.
29newtype State s :: Effect where
28newtype State s :: Effect where
30 State :: MVar s -> State s m r
29 State :: MVar s -> State s m r
31
30
effectful-core/src/Effectful/Writer/Local.hs+3−5
@@ -1,8 +1,6 @@
1−-- | The 'Writer' effect.
1+-- | Support for access to a write only value of a particular type, which is:
2--
2--
3−-- Represented as a pure value underneath, therefore:
4−--
5−-- - thread local (if you need the state to be shared between threads, have a
3+-- - thread local (if you want the value to be shared between threads, have a
6-- look at "Effectful.Writer.Shared"),
4-- look at "Effectful.Writer.Shared"),
7--
5--
8-- - very fast.
6-- - very fast.
@@ -16,7 +14,7 @@
16-- @transformers@ package includes additional operations
14-- @transformers@ package includes additional operations
17-- 'Control.Monad.Trans.Writer.Strict.pass' and
15-- 'Control.Monad.Trans.Writer.Strict.pass' and
18-- 'Control.Monad.Trans.Writer.Strict.censor', they don't cooperate with runtime
16-- 'Control.Monad.Trans.Writer.Strict.censor', they don't cooperate with runtime
19−-- exceptions very well, so they're deliberately omitted.
17+-- exceptions very well, so they're deliberately omitted here.
20module Effectful.Writer.Local
18module Effectful.Writer.Local
21 ( Writer
19 ( Writer
22 , runWriter
20 , runWriter
effectful-core/src/Effectful/Writer/Shared.hs+4−5
@@ -1,8 +1,7 @@
1−-- | The 'Writer' effect.
1+-- | Support for access to a write only value of a particular type, which is:
2--
2--
3−-- Represented as an 'MVar' underneath, therefore:
4−--
5−-- - shareable between multiple threads,
3+-- - shareable between multiple threads (if you want each thead to manage their
4+-- own version of the value, see "Effectful.Writer.Local").
6--
5--
7-- - slower than "Effectful.Writer.Local".
6-- - slower than "Effectful.Writer.Local".
8--
7--
@@ -15,7 +14,7 @@
15-- @transformers@ package includes additional operations
14-- @transformers@ package includes additional operations
16-- 'Control.Monad.Trans.Writer.Strict.pass' and
15-- 'Control.Monad.Trans.Writer.Strict.pass' and
17-- 'Control.Monad.Trans.Writer.Strict.censor', they don't cooperate with runtime
16-- 'Control.Monad.Trans.Writer.Strict.censor', they don't cooperate with runtime
18−-- exceptions very well, so they're deliberately omitted.
17+-- exceptions very well, so they're deliberately omitted here.
19module Effectful.Writer.Shared
18module Effectful.Writer.Shared
20 ( Writer
19 ( Writer
21 , runWriter
20 , runWriter