@@ -26,12 +26,12 @@ import Effectful.Internal.Monad
26----------------------------------------
26----------------------------------------
27-- Interpreter
27-- Interpreter
29−data Interpreter (e :: Effect) = forall localEs. Interpreter
29+data Interpreter (e :: Effect) = forall handlerEs. Interpreter
30− { _env :: Env localEs
30+ { _env :: Env handlerEs
31− , _interpret :: forall a es. HasCallStack
31+ , _interpret :: forall a localEs. HasCallStack
32− => RunIn es IO
32+ => RunIn localEs IO
33− -> e (Eff es) a
33+ -> e (Eff localEs) a
34− -> Eff localEs a
34+ -> Eff handlerEs a
37runInterpreter :: Env es -> Interpreter e -> Eff (e : es) a -> IO a
37runInterpreter :: Env es -> Interpreter e -> Eff (e : es) a -> IO a
@@ -62,32 +62,32 @@ send op = readerEffectM $ \Interpreter{..} -> do
63-- | Interpret a first order effect.
63-- | Interpret a first order effect.
65− :: (forall r es. HasCallStack => e (Eff es) r -> Eff baseEs r)
65+ :: (forall r localEs. HasCallStack => e (Eff localEs) r -> Eff es r)
66− -- ^ The effect handler
66+ -- ^ The effect handler.
67− -> Eff (e : baseEs) a
67+ -> Eff (e : es) a
68− -> Eff baseEs a
68+ -> Eff es a
69interpret interpreter m = unsafeEff $ \es -> do
69interpret interpreter m = unsafeEff $ \es -> do
70 les <- forkEnv es
70 les <- forkEnv es
71 runInterpreter es (Interpreter les $ \_ -> interpreter) m
71 runInterpreter es (Interpreter les $ \_ -> interpreter) m
73−-- | Interpret a higher order effect with help of a function running 'Eff'
73+-- | Interpret a higher order effect with help of a function running local 'Eff'
74−-- operations in the local 'Eff' of an effect handler.
74+-- operations in the context of an effect handler.
76− :: (forall r es. HasCallStack => RunIn es (Eff baseEs) -> e (Eff es) r -> Eff baseEs r)
76+ :: (forall r localEs. HasCallStack => RunIn localEs (Eff es) -> e (Eff localEs) r -> Eff es r)
77− -- ^ The effect handler
77+ -- ^ The effect handler.
78− -> Eff (e : baseEs) a
78+ -> Eff (e : es) a
79− -> Eff baseEs a
79+ -> Eff es a
80interpretM interpreter m = unsafeEff $ \es -> do
80interpretM interpreter m = unsafeEff $ \es -> do
81 les <- forkEnv es
81 les <- forkEnv es
82 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
82 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
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'
85-- operations in 'IO'.
85-- operations in 'IO'.
86interpretIO
86interpretIO
87− :: (forall r es. HasCallStack => RunIn es IO -> e (Eff es) r -> Eff baseEs r)
87+ :: (forall r localEs. HasCallStack => RunIn localEs IO -> e (Eff localEs) r -> Eff es r)
88− -- ^ The effect handler
88+ -- ^ The effect handler.
89− -> Eff (e : baseEs) a
89+ -> Eff (e : es) a
90− -> Eff baseEs a
90+ -> Eff es a
91interpretIO interpreter m = unsafeEff $ \es -> do
91interpretIO interpreter m = unsafeEff $ \es -> do
92 les <- forkEnv es
92 les <- forkEnv es
93 runInterpreter es (Interpreter les interpreter) m
93 runInterpreter es (Interpreter les interpreter) m
@@ -95,42 +95,42 @@ interpretIO interpreter m = unsafeEff $ \es -> do
95----------------------------------------
95----------------------------------------
96-- Reinterpretation
96-- Reinterpretation
98−-- | Interpret a first order effect using local effects.
98+-- | Interpret a first order effect using other effects.
99reinterpret
99reinterpret
100− :: (Eff localEs a -> Eff baseEs b)
100+ :: (Eff handlerEs a -> Eff es b)
101− -- ^ Introduction of local effects
101+ -- ^ Introduction of effects encapsulated within the handler.
102− -> (forall r es. HasCallStack => e (Eff es) r -> Eff localEs r)
102+ -> (forall r localEs. HasCallStack => e (Eff localEs) r -> Eff handlerEs r)
103− -- ^ The effect handler
103+ -- ^ The effect handler.
104− -> Eff (e : baseEs) a
104+ -> Eff (e : es) a
105− -> Eff baseEs b
105+ -> Eff es b
106reinterpret runLocal interpreter m = unsafeEff $ \es -> do
106reinterpret runLocal interpreter m = unsafeEff $ \es -> do
107 les0 <- forkEnv es
107 les0 <- forkEnv es
108 (`unEff` les0) . runLocal . unsafeEff $ \les -> do
108 (`unEff` les0) . runLocal . unsafeEff $ \les -> do
109 runInterpreter es (Interpreter les $ \_ -> interpreter) m
109 runInterpreter es (Interpreter les $ \_ -> interpreter) m
111−-- | Interpret a higher order effect using local effects with help of a function
111+-- | Interpret a higher order effect using other effects with help of a function
112−-- running 'Eff' operations in the local 'Eff' of an effect handler.
112+-- running local 'Eff' operations in the context of an effect handler.
113reinterpretM
113reinterpretM
114− :: (Eff localEs a -> Eff baseEs b)
114+ :: (Eff handlerEs a -> Eff es b)
115− -- ^ Introduction of local effects
115+ -- ^ Introduction of effects encapsulated within the handler.
116− -> (forall r es. HasCallStack => RunIn es (Eff localEs) -> e (Eff es) r -> Eff localEs r)
116+ -> (forall r localEs. HasCallStack => RunIn localEs (Eff handlerEs) -> e (Eff localEs) r -> Eff handlerEs r)
117− -- ^ The effect handler
117+ -- ^ The effect handler.
118− -> Eff (e : baseEs) a
118+ -> Eff (e : es) a
119− -> Eff baseEs b
119+ -> Eff es b
120reinterpretM runLocal interpreter m = unsafeEff $ \es -> do
120reinterpretM runLocal interpreter m = unsafeEff $ \es -> do
121 les0 <- forkEnv es
121 les0 <- forkEnv es
122 (`unEff` les0) . runLocal . unsafeEff $ \les -> do
122 (`unEff` les0) . runLocal . unsafeEff $ \les -> do
123 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
123 runInterpreter es (Interpreter les $ \k -> interpreter $ unsafeEff_ . k) m
125−-- | Interpret a higher order effect using local effects with help of a function
125+-- | Interpret a higher order effect using other effects with help of a function
126−-- running 'Eff' operations in 'IO'.
126+-- running local 'Eff' operations in 'IO'.
127reinterpretIO
127reinterpretIO
128− :: (Eff localEs a -> Eff baseEs b)
128+ :: (Eff handlerEs a -> Eff es b)
129− -- ^ Introduction of local effects
129+ -- ^ Introduction of effects encapsulated within the handler.
130− -> (forall r es. HasCallStack => RunIn es IO -> e (Eff es) r -> Eff localEs r)
130+ -> (forall r localEs. HasCallStack => RunIn localEs IO -> e (Eff localEs) r -> Eff handlerEs r)
131− -- ^ The effect handler
131+ -- ^ The effect handler.
132− -> Eff (e : baseEs) a
132+ -> Eff (e : es) a
133− -> Eff baseEs b
133+ -> Eff es b
134reinterpretIO runLocal interpreter m = unsafeEff $ \es -> do
134reinterpretIO runLocal interpreter m = unsafeEff $ \es -> do
135 les0 <- forkEnv es
135 les0 <- forkEnv es
136 (`unEff` les0) . runLocal . unsafeEff $ \les -> do
136 (`unEff` les0) . runLocal . unsafeEff $ \les -> do