on master help sign in
Rename computations to operations
1dd53a3Andrzej Rybczak
src/Effectful/Async.hs+2−2
@@ -64,9 +64,9 @@ import Effectful.Internal.Effect
64import Effectful.Internal.Env
64import Effectful.Internal.Env
65import Effectful.Internal.Monad
65import Effectful.Internal.Monad
66
66
67−-- | Run 'Eff' computations asynchronously using the @async@ library.
67+-- | Run 'Eff' operations asynchronously via the @async@ library.
68--
68--
69−-- /Note:/ thread local state changes in 'Eff' computations run asynchronously
69+-- /Note:/ thread local state changes in 'Eff' operations run asynchronously
70-- will not affect the parent thread.
70-- will not affect the parent thread.
71data AsyncE :: Effect where
71data AsyncE :: Effect where
72 AsyncE :: AsyncE m r
72 AsyncE :: AsyncE m r
src/Effectful/Internal/Monad.hs+8−6
@@ -54,7 +54,7 @@ type role Eff nominal representational
54
54
55newtype Eff (es :: [Effect]) a = Eff (Env es -> IO a)
55newtype Eff (es :: [Effect]) a = Eff (Env es -> IO a)
56
56
57−-- | Run a pure 'Eff' computation.
57+-- | Run a pure 'Eff' operation.
58--
58--
59-- For the impure version see 'runIOE'.
59-- For the impure version see 'runIOE'.
60runEff :: Eff '[] a -> a
60runEff :: Eff '[] a -> a
@@ -82,11 +82,11 @@ unsafeEff m = Eff (oneShot m)
82unsafeEff_ :: IO a -> Eff es a
82unsafeEff_ :: IO a -> Eff es a
83unsafeEff_ m = unsafeEff $ \_ -> m
83unsafeEff_ m = unsafeEff $ \_ -> m
84
84
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'
86-- environment or 'IO').
86-- environment or 'IO').
87type RunIn es m = forall r. Eff es r -> m r
87type RunIn es m = forall r. Eff es r -> m r
88
88
89−-- | Lower 'Eff' computations into 'IO'.
89+-- | Lower 'Eff' operations into 'IO'.
90--
90--
91-- /Note:/ the 'RunIn' argument has to be called from the same thread as
91-- /Note:/ the 'RunIn' argument has to be called from the same thread as
92-- 'unsafeUnliftEff' ('liftBaseWith' / 'withRunInIO'). Attempting otherwise
92-- 'unsafeUnliftEff' ('liftBaseWith' / 'withRunInIO'). Attempting otherwise
@@ -114,8 +114,8 @@ unsafeUnliftEff f = unsafeEff $ \es -> do
114 tid <- myThreadId
114 tid <- myThreadId
115 if tid == tid0
115 if tid == tid0
116 then unEff m es
116 then unEff m es
117− else error $ "Running Eff computations in a different thread is "
117+ else error $ "Running Eff operations in a different thread is "
118− ++ "currently only possible via the AsyncE effect"
118+ ++ "currently not possible with the unlifting function"
119
119
120----------------------------------------
120----------------------------------------
121-- Base
121-- Base
@@ -171,10 +171,12 @@ instance MonadMask (Eff es) where
171----------------------------------------
171----------------------------------------
172-- IO
172-- IO
173
173
174+-- | Run 'IO' operations via 'MonadIO', 'MonadBaseControl' 'IO' and
175+-- 'MonadUnliftIO' classes.
174data IOE :: Effect where
176data IOE :: Effect where
175 IOE :: IOE m r
177 IOE :: IOE m r
176
178
177−-- | Run an impure 'Eff' computation.
179+-- | Run an impure 'Eff' operation.
178--
180--
179-- For the pure version see 'runEff'.
181-- For the pure version see 'runEff'.
180runIOE :: Eff '[IOE] a -> IO a
182runIOE :: Eff '[IOE] a -> IO a
src/Effectful/Interpreter.hs+4−4
@@ -68,7 +68,7 @@ interpret interpreter m = unsafeEff $ \es -> do
68 runInterpreter es (Interpreter les $ \_ -> interpreter) m
68 runInterpreter es (Interpreter les $ \_ -> interpreter) m
69
69
70-- | Interpret a higher order effect with help of a function running 'Eff'
70-- | 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.
72interpretM
72interpretM
73 :: (forall r es. HasCallStack => RunIn es (Eff baseEs) -> e (Eff es) r -> Eff baseEs r)
73 :: (forall r es. HasCallStack => RunIn es (Eff baseEs) -> e (Eff es) r -> Eff baseEs r)
74 -- ^ The effect handler
74 -- ^ The effect handler
@@ -79,7 +79,7 @@ interpretM interpreter m = unsafeEff $ \es -> do
79 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
79 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
80
80
81-- | Interpret a higher order effect with help of a function running 'Eff'
81-- | Interpret a higher order effect with help of a function running 'Eff'
82−-- computations in 'IO'.
82+-- operations in 'IO'.
83interpretIO
83interpretIO
84 :: (forall r es. HasCallStack => RunIn es IO -> e (Eff es) r -> Eff baseEs r)
84 :: (forall r es. HasCallStack => RunIn es IO -> e (Eff es) r -> Eff baseEs r)
85 -- ^ The effect handler
85 -- ^ The effect handler
@@ -106,7 +106,7 @@ reinterpret runLocal interpreter m = unsafeEff $ \es -> do
106 runInterpreter es (Interpreter les $ \_ -> interpreter) m
106 runInterpreter es (Interpreter les $ \_ -> interpreter) m
107
107
108-- | Interpret a higher order effect using local effects with help of a function
108-- | 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.
110reinterpretM
110reinterpretM
111 :: (Eff localEs a -> Eff baseEs b)
111 :: (Eff localEs a -> Eff baseEs b)
112 -- ^ Introduction of local effects
112 -- ^ Introduction of local effects
@@ -120,7 +120,7 @@ reinterpretM runLocal interpreter m = unsafeEff $ \es -> do
120 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
120 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
121
121
122-- | Interpret a higher order effect using local effects with help of a function
122-- | 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'.
124reinterpretIO
124reinterpretIO
125 :: (Eff localEs a -> Eff baseEs b)
125 :: (Eff localEs a -> Eff baseEs b)
126 -- ^ Introduction of local effects
126 -- ^ Introduction of local effects
src/Effectful/STM.hs+1−1
@@ -9,7 +9,7 @@ import qualified Control.Monad.STM as S
9import Effectful.Internal.Effect
9import Effectful.Internal.Effect
10import Effectful.Internal.Monad
10import Effectful.Internal.Monad
11
11
12−-- | Run 'S.STM' computations using the @stm@ library.
12+-- | Run 'S.STM' operations using the @stm@ library.
13data STME :: Effect where
13data STME :: Effect where
14 STME :: STME m r
14 STME :: STME m r
15
15