1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 20:31:55 +03:00

Define PureEffect & Effect instances for REPL.

Co-Authored-By: Ayman Nadeem <aymannadeem@gmail.com>
This commit is contained in:
Rob Rix 2018-08-01 12:03:28 -04:00
parent 57135b99a6
commit 8da81469bc

View File

@ -15,6 +15,12 @@ output :: (Effectful m, Member REPL effects) => String -> m effects ()
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 = interpret $ \case
Prompt -> liftIO $ do