construct-0.3.0.1: Haskell version of the Construct library for easy specification of file formats
Safe HaskellNone
LanguageHaskell2010

Construct.Classes

Description

The only good reason to import this module is if you intend to add another instance of the classes it exports.

Synopsis

Documentation

class Alternative m => AlternativeFail m where Source #

Subclass of Alternative that carries an error message in case of failure

Minimal complete definition

Nothing

Methods

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

Instances details
AlternativeFail [] Source # 
Instance details

Defined in Construct.Classes

Methods

failure :: String -> [a] Source #

expectedName :: String -> [a] -> [a] Source #

AlternativeFail Maybe Source # 
Instance details

Defined in Construct.Classes

AlternativeFail (Either Error) Source # 
Instance details

Defined in Construct.Classes

class InputMappableParsing m where Source #

A subclass of InputParsing for parsers that can switch the input stream type

Methods

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

Instances details
InputMappableParsing (Parser t) Source # 
Instance details

Defined in Construct.Classes

Methods

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

Minimal complete definition

Nothing

Methods

fixSequence :: (Traversable g, Applicative n) => g m -> m (g n) Source #

This specialized form of traverse can be used inside mfix.

Instances

Instances details
FixTraversable Parser Source # 
Instance details

Defined in Construct.Classes

Methods

fixSequence :: forall g (n :: Type -> Type). (Traversable g, Applicative n) => g Parser -> Parser (g n) Source #

Monoid s => FixTraversable (Parser t s) Source # 
Instance details

Defined in Construct.Classes

Methods

fixSequence :: forall g (n :: Type -> Type). (Traversable g, Applicative n) => g (Parser t s) -> Parser t s (g n) Source #

data Error Source #

Constructors

Error [String] (Maybe String) 

Instances

Instances details
Eq Error Source # 
Instance details

Defined in Construct.Classes

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Show Error Source # 
Instance details

Defined in Construct.Classes

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Semigroup Error Source # 
Instance details

Defined in Construct.Classes

Methods

(<>) :: Error -> Error -> Error #

sconcat :: NonEmpty Error -> Error #

stimes :: Integral b => b -> Error -> Error #

Alternative (Either Error) Source # 
Instance details

Defined in Construct.Classes

AlternativeFail (Either Error) Source # 
Instance details

Defined in Construct.Classes