Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
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)
Asker | |
|
type Asker' m a = Asker m a a Source
An Asker which does not convert its argument into different type after parsing.
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.
forall e . Exception e => SomeAskerError e |
askerErrorUpcast :: Exception a => a -> SomeException Source
askerErrorDowncast :: Exception a => SomeException -> Maybe a Source
data AskerTypeError Source
The input wasn't able to be parsed.
data AskerPredicateError Source
The parsed value failed a predicate.
data AskerInputAbortedError Source
The input for an Asker was aborted by the user.
data GenericTypeError Source
A generic type failure for use with Askers.
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.
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.
data PathExistenceType Source
Indicates whether the target of a path exists and what form it has.
data PathRootDoesNotExist Source
Indicates that no part of a path exists.
data PathIsNotWritable Source
Indicatres that the last existing portion of a path is not writable.
data SomeCommandError Source
Generic error related to command execution.
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.
data TooManyParamsError Source
Too many parameters were given to a command. The first value is the maximum, the second the actual number.
data TooFewParamsError Source
Too few parameters were given to a command. The first value is the minium, the second the actual number.
A REPL command, possibly with parameters.
Command | |
|
data NoConfigFileParseError Source
Indicates that some string was not able to be parsed.