climb-0.4.0: Building blocks for a GHCi-like REPL with colon-commands
Safe HaskellNone
LanguageHaskell2010

Climb

Description

Building blocks for a GHCI-like REPL with colon-commands.

Synopsis

Documentation

type Command m = Text -> m ReplDirective Source #

A Command takes some input, performs some effect, and returns a directive (continue or quit).

data CommandErr Source #

Sometimes things go wrong...

Constructors

CommandErrExpectedNoInput

An option Command got input when it expected None

CommandErrUnknownCommand !Text

An option Command was not found by name.

Instances

Instances details
Eq CommandErr Source # 
Instance details

Defined in Climb

Show CommandErr Source # 
Instance details

Defined in Climb

Exception CommandErr Source # 
Instance details

Defined in Climb

type Completion m = Text -> m [Text] Source #

A Completion takes some input and returns potential matches.

type OptionCommands m = Map Text (Text, Command m) Source #

List of Commands by name with help text.

data ReplDef m Source #

Defines a REPL with commands, options, and completion.

data ReplDirective #

Directive to control voluntary REPL termination.

Constructors

ReplQuit 
ReplContinue 

Instances

Instances details
Eq ReplDirective 
Instance details

Defined in Linenoise.Repl

Show ReplDirective 
Instance details

Defined in Linenoise.Repl

bareCommand :: MonadThrow m => m ReplDirective -> Command m Source #

Helps you define commands that expect no input.

runReplDef :: (MonadCatch m, MonadUnliftIO m) => ReplDef m -> m () Source #

Runs a REPL as defined.