@@ -26,12 +26,12 @@ import Effectful.Internal.Monad
2626----------------------------------------
2727-- Interpreter
2828
29−data Interpreter (e :: Effect) = forall localEs. Interpreter
30− { _env :: Env localEs
31− , _interpret :: forall a es. HasCallStack
32− => RunIn es IO
33− -> e (Eff es) a
34− -> Eff localEs a
29+data Interpreter (e :: Effect) = forall handlerEs. Interpreter
30+ { _env :: Env handlerEs
31+ , _interpret :: forall a localEs. HasCallStack
32+ => RunIn localEs IO
33+ -> e (Eff localEs) a
34+ -> Eff handlerEs a
3535 }
3636
3737runInterpreter :: Env es -> Interpreter e -> Eff (e : es) a -> IO a
@@ -62,32 +62,32 @@ send op = readerEffectM $ \Interpreter{..} -> do
6262
6363-- | Interpret a first order effect.
6464interpret
65− :: (forall r es. HasCallStack => e (Eff es) r -> Eff baseEs r)
66− -- ^ The effect handler
67− -> Eff (e : baseEs) a
68− -> Eff baseEs a
65+ :: (forall r localEs. HasCallStack => e (Eff localEs) r -> Eff es r)
66+ -- ^ The effect handler.
67+ -> Eff (e : es) a
68+ -> Eff es a
6969interpret interpreter m = unsafeEff $ \es -> do
7070 les <- forkEnv es
7171 runInterpreter es (Interpreter les $ \_ -> interpreter) m
7272
73−-- | Interpret a higher order effect with help of a function running 'Eff'
74−-- operations in the local 'Eff' of an effect handler.
73+-- | Interpret a higher order effect with help of a function running local 'Eff'
74+-- operations in the context of an effect handler.
7575interpretM
76− :: (forall r es. HasCallStack => RunIn es (Eff baseEs) -> e (Eff es) r -> Eff baseEs r)
77− -- ^ The effect handler
78− -> Eff (e : baseEs) a
79− -> Eff baseEs a
76+ :: (forall r localEs. HasCallStack => RunIn localEs (Eff es) -> e (Eff localEs) r -> Eff es r)
77+ -- ^ The effect handler.
78+ -> Eff (e : es) a
79+ -> Eff es a
8080interpretM interpreter m = unsafeEff $ \es -> do
8181 les <- forkEnv es
8282 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
8383
84−-- | Interpret a higher order effect with help of a function running 'Eff'
84+-- | Interpret a higher order effect with help of a function running local 'Eff'
8585-- operations in 'IO'.
8686interpretIO
87− :: (forall r es. HasCallStack => RunIn es IO -> e (Eff es) r -> Eff baseEs r)
88− -- ^ The effect handler
89− -> Eff (e : baseEs) a
90− -> Eff baseEs a
87+ :: (forall r localEs. HasCallStack => RunIn localEs IO -> e (Eff localEs) r -> Eff es r)
88+ -- ^ The effect handler.
89+ -> Eff (e : es) a
90+ -> Eff es a
9191interpretIO interpreter m = unsafeEff $ \es -> do
9292 les <- forkEnv es
9393 runInterpreter es (Interpreter les interpreter) m
@@ -95,42 +95,42 @@ interpretIO interpreter m = unsafeEff $ \es -> do
9595----------------------------------------
9696-- Reinterpretation
9797
98−-- | Interpret a first order effect using local effects.
98+-- | Interpret a first order effect using other effects.
9999reinterpret
100− :: (Eff localEs a -> Eff baseEs b)
101− -- ^ Introduction of local effects
102− -> (forall r es. HasCallStack => e (Eff es) r -> Eff localEs r)
103− -- ^ The effect handler
104− -> Eff (e : baseEs) a
105− -> Eff baseEs b
100+ :: (Eff handlerEs a -> Eff es b)
101+ -- ^ Introduction of effects encapsulated within the handler.
102+ -> (forall r localEs. HasCallStack => e (Eff localEs) r -> Eff handlerEs r)
103+ -- ^ The effect handler.
104+ -> Eff (e : es) a
105+ -> Eff es b
106106reinterpret runLocal interpreter m = unsafeEff $ \es -> do
107107 les0 <- forkEnv es
108108 (`unEff` les0) . runLocal . unsafeEff $ \les -> do
109109 runInterpreter es (Interpreter les $ \_ -> interpreter) m
110110
111−-- | Interpret a higher order effect using local effects with help of a function
112−-- running 'Eff' operations in the local 'Eff' of an effect handler.
111+-- | Interpret a higher order effect using other effects with help of a function
112+-- running local 'Eff' operations in the context of an effect handler.
113113reinterpretM
114− :: (Eff localEs a -> Eff baseEs b)
115− -- ^ Introduction of local effects
116− -> (forall r es. HasCallStack => RunIn es (Eff localEs) -> e (Eff es) r -> Eff localEs r)
117− -- ^ The effect handler
118− -> Eff (e : baseEs) a
119− -> Eff baseEs b
114+ :: (Eff handlerEs a -> Eff es b)
115+ -- ^ Introduction of effects encapsulated within the handler.
116+ -> (forall r localEs. HasCallStack => RunIn localEs (Eff handlerEs) -> e (Eff localEs) r -> Eff handlerEs r)
117+ -- ^ The effect handler.
118+ -> Eff (e : es) a
119+ -> Eff es b
120120reinterpretM runLocal interpreter m = unsafeEff $ \es -> do
121121 les0 <- forkEnv es
122122 (`unEff` les0) . runLocal . unsafeEff $ \les -> do
123123 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
124124
125−-- | Interpret a higher order effect using local effects with help of a function
126−-- running 'Eff' operations in 'IO'.
125+-- | Interpret a higher order effect using other effects with help of a function
126+-- running local 'Eff' operations in 'IO'.
127127reinterpretIO
128− :: (Eff localEs a -> Eff baseEs b)
129− -- ^ Introduction of local effects
130− -> (forall r es. HasCallStack => RunIn es IO -> e (Eff es) r -> Eff localEs r)
131− -- ^ The effect handler
132− -> Eff (e : baseEs) a
133− -> Eff baseEs b
128+ :: (Eff handlerEs a -> Eff es b)
129+ -- ^ Introduction of effects encapsulated within the handler.
130+ -> (forall r localEs. HasCallStack => RunIn localEs IO -> e (Eff localEs) r -> Eff handlerEs r)
131+ -- ^ The effect handler.
132+ -> Eff (e : es) a
133+ -> Eff es b
134134reinterpretIO runLocal interpreter m = unsafeEff $ \es -> do
135135 les0 <- forkEnv es
136136 (`unEff` les0) . runLocal . unsafeEff $ \les -> do