Copyright | (c) 2013-2016 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
REPL.Haskeline
Description
Synopsis
- data ReplMode
- crySession :: ReplMode -> Bool -> REPL CommandResult
- data NextLine
- = NextLine [String]
- | NoMoreLines
- | Interrupted
- getInputLines :: String -> InputT REPL NextLine
- loadCryRC :: Cryptolrc -> REPL CommandResult
- repl :: Cryptolrc -> Maybe Config -> LoadProjectMode -> ReplMode -> Bool -> Bool -> REPL () -> IO CommandResult
- setHistoryFile :: Settings REPL -> IO (Settings REPL)
- replSettings :: Bool -> Settings REPL
- data Cryptolrc
- mkTitle :: Maybe LoadedModule -> String
- setREPLTitle :: REPL ()
- shouldSetREPLTitle :: REPL Bool
- canDisplayColor :: REPL Bool
- cryptolCommand :: CompletionFunc REPL
- cmdComp :: String -> CommandDescr -> [Completion]
- cmdArgument :: CommandBody -> CompletionFunc REPL
- keywords :: [String]
- completeExpr :: CompletionFunc REPL
- completeType :: CompletionFunc REPL
- completeHelp :: CompletionFunc REPL
- completeModName :: CompletionFunc REPL
- nameComp :: String -> String -> Completion
- takeIdent :: String -> String
- isIdentChar :: Char -> Bool
- (+++) :: CompletionFunc REPL -> CompletionFunc REPL -> CompletionFunc REPL
- completeOption :: CompletionFunc REPL
Documentation
Constructors
InteractiveRepl | Interactive terminal session |
Batch FilePath | Execute from a batch file |
InteractiveBatch FilePath | Execute from a batch file, but behave as though lines are entered in an interactive session. |
crySession :: ReplMode -> Bool -> REPL CommandResult Source #
One REPL invocation, either from a file or from the terminal.
Constructors
NextLine [String] | |
NoMoreLines | |
Interrupted |
Arguments
:: Cryptolrc | |
-> Maybe Config | |
-> LoadProjectMode | refresh project |
-> ReplMode | |
-> Bool | |
-> Bool | |
-> REPL () | |
-> IO CommandResult |
Haskeline-specific repl implementation.
Configuration of .cryptolrc
file behavior. The default option
searches the following locations in order, and evaluates the first
file that exists in batch mode on interpreter startup:
- $PWD/.cryptolrc
- $HOME/.cryptolrc
If files are specified, they will all be evaluated, but none of the default files will be (unless they are explicitly specified).
The disabled option inhibits any reading of any .cryptolrc files.
Constructors
CryrcDefault | |
CryrcDisabled | |
CryrcFiles [FilePath] |
setREPLTitle :: REPL () Source #
shouldSetREPLTitle :: REPL Bool Source #
In certain environments like Emacs, we shouldn't set the terminal title. Note: this does not imply we can't use color output. We can use ANSI color sequences in places like Emacs, but not terminal codes.
This checks that
is a proper terminal handle, and that the
terminal mode is not stdout
dumb
, which is set by Emacs and others.
canDisplayColor :: REPL Bool Source #
Whether we can display color titles. This checks that
is a proper terminal handle, and that the terminal mode is not
stdout
dumb
, which is set by Emacs and others.
cryptolCommand :: CompletionFunc REPL Source #
Completion for cryptol commands.
cmdComp :: String -> CommandDescr -> [Completion] Source #
Generate completions from a REPL command definition.
cmdArgument :: CommandBody -> CompletionFunc REPL Source #
Dispatch to a completion function based on the kind of completion the command is expecting.
completeExpr :: CompletionFunc REPL Source #
Complete a name from the expression environment.
completeType :: CompletionFunc REPL Source #
Complete a name from the type synonym environment.
completeHelp :: CompletionFunc REPL Source #
Complete a name for which we can show REPL help documentation.
completeModName :: CompletionFunc REPL Source #
Complete a name from the list of loaded modules.
takeIdent :: String -> String Source #
Return longest identifier (possibly a qualified name) that is a prefix of the given string
isIdentChar :: Char -> Bool Source #
(+++) :: CompletionFunc REPL -> CompletionFunc REPL -> CompletionFunc REPL Source #
Join two completion functions together, merging and sorting their results.
completeOption :: CompletionFunc REPL Source #
Complete an option from the options environment.
XXX this can do better, as it has access to the expected form of the value