climb-0.3.1: 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 CommandExc Source #

Sometimes things go wrong...

Constructors

ExpectedNoInputError

An option Command got input when it expected None

MissingCommandError !Text

An option Command was not found by name.

Instances
Eq CommandExc Source # 
Instance details

Defined in Climb

Show CommandExc Source # 
Instance details

Defined in Climb

Exception CommandExc 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
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 :: (MonadThrow m, MonadUnliftIO m) => ReplDef m -> m () Source #

Runs a REPL as defined.