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 = forall e . Exception e => SomeREPLError e
- replErrorUpcast :: Exception a => a -> SomeException
- replErrorDowncast :: Exception a => SomeException -> Maybe a
- data SomeAskerError = forall e . 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 = forall e . 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 failied 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 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 different type after parsing.
data SomeREPLError Source
Root of the exception hierarchy.
Constructors
forall e . 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 Asker
s. Either the input was incorrect
in some way, or the process was aborted by the user.
Constructors
forall e . Exception e => SomeAskerError e |
Instances
askerErrorUpcast :: Exception a => a -> SomeException Source
askerErrorDowncast :: Exception a => SomeException -> Maybe a Source
data AskerTypeError Source
The input wasn't able to be parsed.
Constructors
AskerTypeError SomeException |
Instances
data AskerPredicateError Source
The parsed value failed a predicate.
Constructors
AskerPredicateError SomeException |
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 |
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
Indicatres that the last existing portion of a path is not writable.
Constructors
PathIsNotWritable FilePath |
data SomeCommandError Source
Generic error related to command execution.
Constructors
forall e . Exception e => SomeCommandError e |
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 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 |