Safe Haskell | None |
---|---|
Language | Haskell2010 |
The only good reason to import this module is if you intend to add another instance of the classes it exports.
Synopsis
- class Alternative m => AlternativeFail m where
- failure :: String -> m a
- expectedName :: String -> m a -> m a
- class InputMappableParsing m where
- mapParserInput :: (InputParsing (m s), s ~ ParserInput (m s), Monoid s, Monoid s') => (s -> s') -> (s' -> s) -> m s a -> m s' a
- mapMaybeParserInput :: (InputParsing (m s), s ~ ParserInput (m s), Monoid s, Monoid s') => (s -> Maybe s') -> (s' -> Maybe s) -> m s a -> m s' a
- class Monad m => FixTraversable m where
- fixSequence :: (Traversable g, Applicative n) => g m -> m (g n)
- data Error = Error [String] (Maybe String)
- errorString :: Error -> String
- concatExpected :: [String] -> Maybe String
- oxfordComma :: String -> [String] -> String
Documentation
class Alternative m => AlternativeFail m where Source #
Subclass of Alternative
that carries an error message in case of failure
Nothing
failure :: String -> m a Source #
Equivalent to empty
except it takes an error message it may carry or drop on the floor. The grammatical form
of the argument should be a noun representing the unexpected value.
expectedName :: String -> m a -> m a Source #
Sets or modifies the expected value.
Instances
AlternativeFail [] Source # | |
Defined in Construct.Classes | |
AlternativeFail Maybe Source # | |
AlternativeFail (Either Error) Source # | |
class InputMappableParsing m where Source #
A subclass of InputParsing
for parsers that can switch the input stream type
mapParserInput :: (InputParsing (m s), s ~ ParserInput (m s), Monoid s, Monoid s') => (s -> s') -> (s' -> s) -> m s a -> m s' a Source #
Converts a parser accepting one input stream type to another. The functions forth
and back
must be
inverses of each other and they must distribute through <>
:
f (s1 <> s2) == f s1 <> f s2
mapMaybeParserInput :: (InputParsing (m s), s ~ ParserInput (m s), Monoid s, Monoid s') => (s -> Maybe s') -> (s' -> Maybe s) -> m s a -> m s' a Source #
Converts a parser accepting one input stream type to another just like mapParserInput
, except the argument
functions can return Nothing
to indicate they need more input.
Instances
InputMappableParsing (Parser t) Source # | |
Defined in Construct.Classes mapParserInput :: (InputParsing (Parser t s), s ~ ParserInput (Parser t s), Monoid s, Monoid s') => (s -> s') -> (s' -> s) -> Parser t s a -> Parser t s' a Source # mapMaybeParserInput :: (InputParsing (Parser t s), s ~ ParserInput (Parser t s), Monoid s, Monoid s') => (s -> Maybe s') -> (s' -> Maybe s) -> Parser t s a -> Parser t s' a Source # |
class Monad m => FixTraversable m where Source #
A subclass of MonadFix
for monads that can fix a function that handles higher-kinded data
Nothing
fixSequence :: (Traversable g, Applicative n) => g m -> m (g n) Source #
This specialized form of traverse
can be used inside mfix
.
Instances
FixTraversable Parser Source # | |
Defined in Construct.Classes fixSequence :: forall g (n :: Type -> Type). (Traversable g, Applicative n) => g Parser -> Parser (g n) Source # | |
Monoid s => FixTraversable (Parser t s) Source # | |
Defined in Construct.Classes fixSequence :: forall g (n :: Type -> Type). (Traversable g, Applicative n) => g (Parser t s) -> Parser t s (g n) Source # |
errorString :: Error -> String Source #