| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
System.REPL.Types
Description
Types used by other modules in the package.
The module contains the following exception hierarchy:
- type TypeError = SomeException
- type PredicateError = SomeException
- type PromptMsg = Text
- type Predicate m a b = a -> m (Either PredicateError b)
- type Predicate' m a = Predicate m a a
- type Parser a = Text -> Either TypeError a
- data Asker m a b = Asker {
- askerPrompt :: Text
- askerParser :: Parser a
- askerPredicate :: Predicate m a b
- type Asker' m a = Asker m a a
- data SomeREPLError = Exception e => SomeREPLError e
- replErrorUpcast :: Exception a => a -> SomeException
- replErrorDowncast :: Exception a => SomeException -> Maybe a
- data SomeAskerError = Exception e => SomeAskerError e
- askerErrorUpcast :: Exception a => a -> SomeException
- askerErrorDowncast :: Exception a => SomeException -> Maybe a
- data AskerTypeError = AskerTypeError SomeException
- data AskerPredicateError = AskerPredicateError SomeException
- data AskerInputAbortedError = AskerInputAbortedError
- data GenericTypeError = GenericTypeError Text
- genericTypeError :: Text -> SomeException
- data GenericPredicateError = GenericPredicateError Text
- genericPredicateError :: Text -> SomeException
- newtype Verbatim = Verbatim {
- fromVerbatim :: Text
- data PathExistenceType
- data PathRootDoesNotExist = PathRootDoesNotExist FilePath
- data PathIsNotWritable = PathIsNotWritable FilePath
- data SomeCommandError = Exception e => SomeCommandError e
- commandErrorUpcast :: Exception a => a -> SomeException
- commandErrorDowncast :: Exception a => SomeException -> Maybe a
- data MalformedParamsError = MalformedParamsError Text
- data TooManyParamsError = TooManyParamsError Int Int
- data TooFewParamsError = TooFewParamsError Int Int
- data Command m i a = Command {
- commandName :: Text
- commandTest :: i -> Bool
- commandDesc :: Text
- runPartialCommand :: [i] -> m (a, [i])
- data NoConfigFileParseError = NoConfigFileParseError Text
Documentation
type TypeError = SomeException Source #
An error message indicating that a value wasn't able to be parsed.
type PredicateError = SomeException Source #
An error message indicating that a value failed a predicate.
type Predicate m a b = a -> m (Either PredicateError b) Source #
A predicate which a value has to fulfil.
type Predicate' m a = Predicate m a a Source #
A predicate which does not change the type of its input.
type Parser a = Text -> Either TypeError a Source #
A parser which either returns a parsed value or an error message.
The description of an 'ask for user input'-action.
The type parameters are the used monad (typically IO or ExceptT),
the type of the read value and the type of the error that is thrown
in case of failures.
The components are a prompt, a parser, and a predicate that the parsed value must fulfil. The predicate
- is monadic and
- can change the returned type (useful for adjoining additional information)
Constructors
| Asker | |
Fields
| |
type Asker' m a = Asker m a a Source #
An Asker which does not convert its argument into a different type after parsing.
data SomeREPLError Source #
Root of the exception hierarchy.
Constructors
| Exception e => SomeREPLError e |
Instances
replErrorUpcast :: Exception a => a -> SomeException Source #
replErrorDowncast :: Exception a => SomeException -> Maybe a Source #
data SomeAskerError Source #
Generic error related to Askers. Either the input was incorrect
in some way, or the process was aborted by the user.
Constructors
| Exception e => SomeAskerError e |
Instances
askerErrorUpcast :: Exception a => a -> SomeException Source #
askerErrorDowncast :: Exception a => SomeException -> Maybe a Source #
data AskerTypeError Source #
The input could not be parsed.
Constructors
| AskerTypeError SomeException |
Instances
data AskerPredicateError Source #
The parsed value failed a predicate.
Constructors
| AskerPredicateError SomeException |
Instances
data AskerInputAbortedError Source #
The input for an Asker was aborted by the user.
Constructors
| AskerInputAbortedError |
data GenericTypeError Source #
A generic type failure for use with Askers.
Constructors
| GenericTypeError Text |
Instances
genericTypeError :: Text -> SomeException Source #
Constructor for GenericTypeError which wraps the value into a SomeException.
data GenericPredicateError Source #
A generic predicate failure for use with Askers.
Constructors
| GenericPredicateError Text |
genericPredicateError :: Text -> SomeException Source #
Constructor for GenericTypeError which wraps the value into a SomeException.
A verbatim Text whose Read instance simply returns the read string, as-is. This is useful for askers which ask for strings without quotes.
Constructors
| Verbatim | |
Fields
| |
data PathExistenceType Source #
Indicates whether the target of a path exists and what form it has.
Constructors
| IsDirectory | |
| IsFile | |
| DoesNotExist |
data PathRootDoesNotExist Source #
Indicates that no part of a path exists.
Constructors
| PathRootDoesNotExist FilePath |
data PathIsNotWritable Source #
Indicates that the last existing portion of a path is not writable.
Constructors
| PathIsNotWritable FilePath |
data SomeCommandError Source #
Generic error related to command execution.
Constructors
| Exception e => SomeCommandError e |
Instances
commandErrorUpcast :: Exception a => a -> SomeException Source #
commandErrorDowncast :: Exception a => SomeException -> Maybe a Source #
data MalformedParamsError Source #
The input of a command was malformed and could not be interpreted. I.e.
the input contained inadmissible characters, or quotes were mismatched.
The Text argument contains the parser error.
Constructors
| MalformedParamsError Text |
data TooManyParamsError Source #
Too many parameters were given to a command. The first value is the maximum, the second the actual number.
Constructors
| TooManyParamsError Int Int |
data TooFewParamsError Source #
Too few parameters were given to a command. The first value is the minium, the second the actual number.
Constructors
| TooFewParamsError Int Int |
A REPL command, possibly with parameters.
Constructors
| Command | |
Fields
| |
data NoConfigFileParseError Source #
Indicates that some string was not able to be parsed.
Constructors
| NoConfigFileParseError Text |