mirror of
https://github.com/github/semantic.git
synced 2024-12-19 04:41:47 +03:00
Define PureEffect & Effect instances for REPL.
Co-Authored-By: Ayman Nadeem <aymannadeem@gmail.com>
This commit is contained in:
parent
57135b99a6
commit
8da81469bc
@ -15,6 +15,12 @@ output :: (Effectful m, Member REPL effects) => String -> m effects ()
|
|||||||
output s = send (Output s)
|
output s = send (Output s)
|
||||||
|
|
||||||
|
|
||||||
|
instance PureEffect REPL
|
||||||
|
instance Effect REPL where
|
||||||
|
handleState state handler (Request Prompt k) = Request Prompt (handler . (<$ state) . k)
|
||||||
|
handleState state handler (Request (Output s) k) = Request (Output s) (handler . (<$ state) . k)
|
||||||
|
|
||||||
|
|
||||||
runREPL :: (Effectful m, MonadIO (m effects), PureEffects effects) => m (REPL ': effects) a -> m effects a
|
runREPL :: (Effectful m, MonadIO (m effects), PureEffects effects) => m (REPL ': effects) a -> m effects a
|
||||||
runREPL = interpret $ \case
|
runREPL = interpret $ \case
|
||||||
Prompt -> liftIO $ do
|
Prompt -> liftIO $ do
|
||||||
|
Loading…
Reference in New Issue
Block a user