on master help sign in
Rename computations to operations
commit1dd53a3de212a3ec87d5de553f48277d8be22335 authorAndrzej Rybczak <andrzej@rybczak.net> dateMon 28 Jun 2021, 20:06 (5 years ago) parent4f77232
4 files changed+15−13
src/Effectful/Async.hs+2−2 src/Effectful/Internal/Monad.hs+8−6 src/Effectful/Interpreter.hs+4−4 src/Effectful/STM.hs+1−1
src/Effectful/Async.hs+2−2
@@ -64,9 +64,9 @@ import Effectful.Internal.Effect
6464import Effectful.Internal.Env
6565import Effectful.Internal.Monad
6666
67−-- | Run 'Eff' computations asynchronously using the @async@ library.
67+-- | Run 'Eff' operations asynchronously via the @async@ library.
6868--
69−-- /Note:/ thread local state changes in 'Eff' computations run asynchronously
69+-- /Note:/ thread local state changes in 'Eff' operations run asynchronously
7070-- will not affect the parent thread.
7171data AsyncE :: Effect where
7272 AsyncE :: AsyncE m r
src/Effectful/Internal/Monad.hs+8−6
@@ -54,7 +54,7 @@ type role Eff nominal representational
5454
5555newtype Eff (es :: [Effect]) a = Eff (Env es -> IO a)
5656
57−-- | Run a pure 'Eff' computation.
57+-- | Run a pure 'Eff' operation.
5858--
5959-- For the impure version see 'runIOE'.
6060runEff :: Eff '[] a -> a
@@ -82,11 +82,11 @@ unsafeEff m = Eff (oneShot m)
8282unsafeEff_ :: IO a -> Eff es a
8383unsafeEff_ m = unsafeEff $ \_ -> m
8484
85−-- | A function that runs 'Eff' computations in @m@ (usually a local 'Eff'
85+-- | A function that runs 'Eff' operations in @m@ (usually a local 'Eff'
8686-- environment or 'IO').
8787type RunIn es m = forall r. Eff es r -> m r
8888
89−-- | Lower 'Eff' computations into 'IO'.
89+-- | Lower 'Eff' operations into 'IO'.
9090--
9191-- /Note:/ the 'RunIn' argument has to be called from the same thread as
9292-- 'unsafeUnliftEff' ('liftBaseWith' / 'withRunInIO'). Attempting otherwise
@@ -114,8 +114,8 @@ unsafeUnliftEff f = unsafeEff $ \es -> do
114114 tid <- myThreadId
115115 if tid == tid0
116116 then unEff m es
117− else error $ "Running Eff computations in a different thread is "
118− ++ "currently only possible via the AsyncE effect"
117+ else error $ "Running Eff operations in a different thread is "
118+ ++ "currently not possible with the unlifting function"
119119
120120----------------------------------------
121121-- Base
@@ -171,10 +171,12 @@ instance MonadMask (Eff es) where
171171----------------------------------------
172172-- IO
173173
174+-- | Run 'IO' operations via 'MonadIO', 'MonadBaseControl' 'IO' and
175+-- 'MonadUnliftIO' classes.
174176data IOE :: Effect where
175177 IOE :: IOE m r
176178
177−-- | Run an impure 'Eff' computation.
179+-- | Run an impure 'Eff' operation.
178180--
179181-- For the pure version see 'runEff'.
180182runIOE :: Eff '[IOE] a -> IO a
src/Effectful/Interpreter.hs+4−4
@@ -68,7 +68,7 @@ interpret interpreter m = unsafeEff $ \es -> do
6868 runInterpreter es (Interpreter les $ \_ -> interpreter) m
6969
7070-- | Interpret a higher order effect with help of a function running 'Eff'
71−-- computations in the local 'Eff' of an effect handler.
71+-- operations in the local 'Eff' of an effect handler.
7272interpretM
7373 :: (forall r es. HasCallStack => RunIn es (Eff baseEs) -> e (Eff es) r -> Eff baseEs r)
7474 -- ^ The effect handler
@@ -79,7 +79,7 @@ interpretM interpreter m = unsafeEff $ \es -> do
7979 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
8080
8181-- | Interpret a higher order effect with help of a function running 'Eff'
82−-- computations in 'IO'.
82+-- operations in 'IO'.
8383interpretIO
8484 :: (forall r es. HasCallStack => RunIn es IO -> e (Eff es) r -> Eff baseEs r)
8585 -- ^ The effect handler
@@ -106,7 +106,7 @@ reinterpret runLocal interpreter m = unsafeEff $ \es -> do
106106 runInterpreter es (Interpreter les $ \_ -> interpreter) m
107107
108108-- | Interpret a higher order effect using local effects with help of a function
109−-- running 'Eff' computations in the local 'Eff' of an effect handler.
109+-- running 'Eff' operations in the local 'Eff' of an effect handler.
110110reinterpretM
111111 :: (Eff localEs a -> Eff baseEs b)
112112 -- ^ Introduction of local effects
@@ -120,7 +120,7 @@ reinterpretM runLocal interpreter m = unsafeEff $ \es -> do
120120 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
121121
122122-- | Interpret a higher order effect using local effects with help of a function
123−-- running 'Eff' computations in 'IO'.
123+-- running 'Eff' operations in 'IO'.
124124reinterpretIO
125125 :: (Eff localEs a -> Eff baseEs b)
126126 -- ^ Introduction of local effects
src/Effectful/STM.hs+1−1
@@ -9,7 +9,7 @@ import qualified Control.Monad.STM as S
99import Effectful.Internal.Effect
1010import Effectful.Internal.Monad
1111
12−-- | Run 'S.STM' computations using the @stm@ library.
12+-- | Run 'S.STM' operations using the @stm@ library.
1313data STME :: Effect where
1414 STME :: STME m r
1515