cryptol-2.2.6: Cryptol: The Language of Cryptography

Copyright | (c) 2013-2015 Galois, Inc.
License | BSD3
Maintainer | cryptol@galois.com
Stability | provisional
Portability | portable
Safe Haskell | None
Language | Haskell98

Cryptol.REPL.Command

Contents

- Commands

Description

Synopsis

- data Command
  - = Command (REPL ())
  - | Ambiguous String [String]
  - | Unknown String
- data CommandDescr = CommandDescr {
  - cNames :: [String]
  - cBody :: CommandBody
  - cHelp :: String
  }
- data CommandBody
  - = ExprArg (String -> REPL ())
  - | DeclsArg (String -> REPL ())
  - | ExprTypeArg (String -> REPL ())
  - | FilenameArg (FilePath -> REPL ())
  - | OptionArg (String -> REPL ())
  - | ShellArg (String -> REPL ())
  - | NoArg (REPL ())
- parseCommand :: (String -> [CommandDescr]) -> String -> Maybe Command
- runCommand :: Command -> REPL ()
- splitCommand :: String -> Maybe (String, String)
- findCommand :: String -> [CommandDescr]
- findCommandExact :: String -> [CommandDescr]
- findNbCommand :: Bool -> String -> [CommandDescr]
- moduleCmd :: String -> REPL ()
- loadCmd :: FilePath -> REPL ()
- loadPrelude :: REPL ()
- handleCtrlC :: REPL ()
- sanitize :: String -> String
- replParse :: (String -> Either ParseError a) -> String -> REPL a
- liftModuleCmd :: ModuleCmd a -> REPL a
- moduleCmdResult :: ModuleRes a -> REPL a

# Commands

data Command Source

Commands.

Constructors

Command (REPL ()) | Successfully parsed command
Ambiguous String [String] | Ambiguous command, list of conflicting commands
Unknown String | The unknown command

data CommandDescr Source

Command builder.

Constructors

CommandDescr |

Fields

cNames :: [String]
cBody :: CommandBody
cHelp :: String

Instances

Eq CommandDescr Source |
Ord CommandDescr Source |
Show CommandDescr Source |

data CommandBody Source

Constructors

ExprArg (String -> REPL ()) |
DeclsArg (String -> REPL ()) |
ExprTypeArg (String -> REPL ()) |
FilenameArg (FilePath -> REPL ()) |
OptionArg (String -> REPL ()) |
ShellArg (String -> REPL ()) |
NoArg (REPL ()) |

parseCommand :: (String -> [CommandDescr]) -> String -> Maybe Command Source

Parse a line as a command.

runCommand :: Command -> REPL () Source

Run a command.

splitCommand :: String -> Maybe (String, String) Source

Split at the first word boundary.

findCommand :: String -> [CommandDescr] Source

Lookup a string in the command list.

findCommandExact :: String -> [CommandDescr] Source

Lookup a string in the command list, returning an exact match even if it's the prefix of another command.

findNbCommand :: Bool -> String -> [CommandDescr] Source

Lookup a string in the notebook-safe command list.

moduleCmd :: String -> REPL () Source

loadCmd :: FilePath -> REPL () Source

loadPrelude :: REPL () Source

handleCtrlC :: REPL () Source

sanitize :: String -> String Source

Strip leading space.

replParse :: (String -> Either ParseError a) -> String -> REPL a Source

Lift a parsing action into the REPL monad.

liftModuleCmd :: ModuleCmd a -> REPL a Source

moduleCmdResult :: ModuleRes a -> REPL a Source