Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Helper functions and transformer to write your own REPLs.
Synopsis
- data ReplDirective
- newtype ReplT r s m a = ReplT {}
- replM :: MonadUnliftIO m => ReplDirective -> Text -> (Text -> m ReplDirective) -> (Text -> m [Text]) -> m ()
- runReplT :: MonadIO m => ReplT r s m a -> r -> s -> m (a, s)
Documentation
data ReplDirective Source #
Directive to control voluntary REPL termination.
Instances
Show ReplDirective Source # | |
Defined in Linenoise.Repl showsPrec :: Int -> ReplDirective -> ShowS # show :: ReplDirective -> String # showList :: [ReplDirective] -> ShowS # | |
Eq ReplDirective Source # | |
Defined in Linenoise.Repl (==) :: ReplDirective -> ReplDirective -> Bool # (/=) :: ReplDirective -> ReplDirective -> Bool # |
newtype ReplT r s m a Source #
Basic monad transformer with mutable state that can be used with all Linenoise.Unlift functions. You do not have to use this, but it's here to cover most of what you would need without having to roll your own newtype.
Instances
Monad m => MonadReader r (ReplT r s m) Source # | |
MonadIO m => MonadState s (ReplT r s m) Source # | |
MonadTrans (ReplT r s) Source # | |
Defined in Linenoise.Repl | |
MonadFail m => MonadFail (ReplT r s m) Source # | |
Defined in Linenoise.Repl | |
MonadFix m => MonadFix (ReplT r s m) Source # | |
Defined in Linenoise.Repl | |
MonadIO m => MonadIO (ReplT r s m) Source # | |
Defined in Linenoise.Repl | |
MonadZip m => MonadZip (ReplT r s m) Source # | |
Alternative m => Alternative (ReplT r s m) Source # | |
Applicative m => Applicative (ReplT r s m) Source # | |
Defined in Linenoise.Repl | |
Functor m => Functor (ReplT r s m) Source # | |
Monad m => Monad (ReplT r s m) Source # | |
MonadPlus m => MonadPlus (ReplT r s m) Source # | |
MonadCatch m => MonadCatch (ReplT r s m) Source # | |
Defined in Linenoise.Repl | |
MonadThrow m => MonadThrow (ReplT r s m) Source # | |
Defined in Linenoise.Repl throwM :: (HasCallStack, Exception e) => e -> ReplT r s m a # | |
MonadUnliftIO m => MonadUnliftIO (ReplT r s m) Source # | |
Defined in Linenoise.Repl |
:: MonadUnliftIO m | |
=> ReplDirective | Directive on interrupt |
-> Text | Prompt |
-> (Text -> m ReplDirective) | Action |
-> (Text -> m [Text]) | Completion |
-> m () |
Run a simple REPL.