on master help sign in
Adjust documentation of State effects
commit6cf8c66155988225e135305c749ebfaaef10d10d authorAndrzej Rybczak <andrzej@rybczak.net> dateMon 28 Jun 2021, 20:13 (5 years ago) parent1dd53a3
3 files changed+9−9
src/Effectful/State.hs+4−4 src/Effectful/State/Dynamic.hs+1−1 src/Effectful/State/MVar.hs+4−4
src/Effectful/State.hs+4−4
@@ -1,10 +1,10 @@
1−-- | The 'State' as an effect.
1+-- | The 'State' effect.
22--
33-- Represented as a pure value underneath, therefore:
44--
5−-- - very fast,
5+-- - thread local (if you need sharing, have a look at "Effectful.State.MVar"),
66--
7−-- - thread local (if you need sharing, have a look at "Effectful.State.MVar").
7+-- - very fast.
88--
99module Effectful.State
1010 ( State
@@ -23,7 +23,7 @@ module Effectful.State
2323import Effectful.Internal.Effect
2424import Effectful.Internal.Monad
2525
26−-- | Provide access to a pure, mutable state of type @s@.
26+-- | Provide access to a strict, thread local, mutable state of type @s@.
2727newtype State s :: Effect where
2828 State :: s -> State s m r
2929
src/Effectful/State/Dynamic.hs+1−1
@@ -1,4 +1,4 @@
1−-- | The 'State' as an effect with dynamic dispatch.
1+-- | The 'State' effect with dynamic dispatch.
22--
33-- It's not clear in which situation it's beneficial to use this instead of
44-- "Effectful.State" or "Effectful.State.MVar" as you either:
src/Effectful/State/MVar.hs+4−4
@@ -1,8 +1,8 @@
1−-- | The 'State' as an effect.
1+-- | The 'State' effect.
22--
3−-- Represented as an MVar underneath, therefore:
3+-- Represented as an 'MVar' underneath, therefore:
44--
5−-- - suitable for sharing between multiple threads,
5+-- - shareable between multiple threads,
66--
77-- - slower than "Effectful.State".
88--
@@ -25,7 +25,7 @@ import Control.Concurrent.MVar
2525import Effectful.Internal.Effect
2626import Effectful.Internal.Monad
2727
28−-- | Provide access to a synchronized, mutable state of type @s@.
28+-- | Provide access to a strict, shareable, mutable state of type @s@.
2929newtype State s :: Effect where
3030 State :: MVar s -> State s m r
3131