input-parsers-0.3.0.2: Extension of the parsers library with more capability and efficiency

Safe Haskell | None
Language | Haskell2010

Text.Parser.Deterministic

Description

Deterministic parsers can be restricted to succeed with a single parsing result.

Synopsis

- class Parsing m => DeterministicParsing (m :: Type -> Type) where
  - (<<|>) :: m a -> m a -> m a
  - takeOptional :: m a -> m (Maybe a)
  - takeMany :: m a -> m [a]
  - takeSome :: m a -> m [a]
  - concatAll :: Monoid a => m a -> m a
  - skipAll :: m a -> m ()

# Documentation

class Parsing m => DeterministicParsing (m :: Type -> Type) where Source #

Combinator methods for constructing deterministic parsers, i.e., parsers that can succeed with only a single result.

Minimal complete definition

Nothing

Methods

(<<|>) :: m a -> m a -> m a infixl 3 Source #

Left-biased choice: if the left alternative succeeds, the right one is never tried.

takeOptional :: m a -> m (Maybe a) Source #

Like `optional`, but never succeeds with `Nothing` if the argument parser can succeed.

takeMany :: m a -> m [a] Source #

Like `many`, but always consuming the longest matching sequence of input.

takeSome :: m a -> m [a] Source #

Like `some`, but always consuming the longest matching sequence of input.

concatAll :: Monoid a => m a -> m a Source #

Like `concatMany`, but always consuming the longest matching sequence of input.

skipAll :: m a -> m () Source #

Like `skipMany`, but always consuming the longest matching sequence of input.

#### Instances

Instances details

DeterministicParsing Parser Source # |
Instance details Defined in Text.Parser.Deterministic Methods (<<|>) :: Parser a -> Parser a -> Parser a Source # takeOptional :: Parser a -> Parser (Maybe a) Source # takeMany :: Parser a -> Parser [a] Source # takeSome :: Parser a -> Parser [a] Source # concatAll :: Monoid a => Parser a -> Parser a Source # skipAll :: Parser a -> Parser () Source #
DeterministicParsing Parser Source # |
Instance details Defined in Text.Parser.Deterministic Methods (<<|>) :: Parser a -> Parser a -> Parser a Source # takeOptional :: Parser a -> Parser (Maybe a) Source # takeMany :: Parser a -> Parser [a] Source # takeSome :: Parser a -> Parser [a] Source # concatAll :: Monoid a => Parser a -> Parser a Source # skipAll :: Parser a -> Parser () Source #
DeterministicParsing ReadP Source # |
Instance details Defined in Text.Parser.Deterministic Methods (<<|>) :: ReadP a -> ReadP a -> ReadP a Source # takeOptional :: ReadP a -> ReadP (Maybe a) Source # takeMany :: ReadP a -> ReadP [a] Source # takeSome :: ReadP a -> ReadP [a] Source # concatAll :: Monoid a => ReadP a -> ReadP a Source # skipAll :: ReadP a -> ReadP () Source #
DeterministicParsing (Lazy Get) Source # |
Instance details Defined in Text.Parser.Deterministic Methods (<<|>) :: Lazy Get a -> Lazy Get a -> Lazy Get a Source # takeOptional :: Lazy Get a -> Lazy Get (Maybe a) Source # takeMany :: Lazy Get a -> Lazy Get [a] Source # takeSome :: Lazy Get a -> Lazy Get [a] Source # concatAll :: Monoid a => Lazy Get a -> Lazy Get a Source # skipAll :: Lazy Get a -> Lazy Get () Source #
DeterministicParsing (Strict Get) Source # |

Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: Strict Get a -> Strict Get a -> Strict Get a Source #

takeOptional :: Strict Get a -> Strict Get (Maybe a) Source #

takeMany :: Strict Get a -> Strict Get [a] Source #

takeSome :: Strict Get a -> Strict Get [a] Source #

concatAll :: Monoid a => Strict Get a -> Strict Get a Source #

skipAll :: Strict Get a -> Strict Get () Source #

(Monad m, DeterministicParsing m) => DeterministicParsing (IdentityT m) Source # |

Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: IdentityT m a -> IdentityT m a -> IdentityT m a Source #

takeOptional :: IdentityT m a -> IdentityT m (Maybe a) Source #

takeMany :: IdentityT m a -> IdentityT m [a] Source #

takeSome :: IdentityT m a -> IdentityT m [a] Source #

concatAll :: Monoid a => IdentityT m a -> IdentityT m a Source #

skipAll :: IdentityT m a -> IdentityT m () Source #

(MonadPlus m, DeterministicParsing m) => DeterministicParsing (ReaderT e m) Source # |

Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: ReaderT e m a -> ReaderT e m a -> ReaderT e m a Source #

takeOptional :: ReaderT e m a -> ReaderT e m (Maybe a) Source #

takeMany :: ReaderT e m a -> ReaderT e m [a] Source #

takeSome :: ReaderT e m a -> ReaderT e m [a] Source #

concatAll :: Monoid a => ReaderT e m a -> ReaderT e m a Source #

skipAll :: ReaderT e m a -> ReaderT e m () Source #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (StateT w m) Source # |

Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: StateT w m a -> StateT w m a -> StateT w m a Source #

takeOptional :: StateT w m a -> StateT w m (Maybe a) Source #

takeMany :: StateT w m a -> StateT w m [a] Source #

takeSome :: StateT w m a -> StateT w m [a] Source #

concatAll :: Monoid a => StateT w m a -> StateT w m a Source #

skipAll :: StateT w m a -> StateT w m () Source #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (StateT w m) Source # |

Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: StateT w m a -> StateT w m a -> StateT w m a Source #

takeOptional :: StateT w m a -> StateT w m (Maybe a) Source #

takeMany :: StateT w m a -> StateT w m [a] Source #

takeSome :: StateT w m a -> StateT w m [a] Source #

concatAll :: Monoid a => StateT w m a -> StateT w m a Source #

skipAll :: StateT w m a -> StateT w m () Source #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (WriterT w m) Source # |

Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a Source #

takeOptional :: WriterT w m a -> WriterT w m (Maybe a) Source #

takeMany :: WriterT w m a -> WriterT w m [a] Source #

takeSome :: WriterT w m a -> WriterT w m [a] Source #

concatAll :: Monoid a => WriterT w m a -> WriterT w m a Source #

skipAll :: WriterT w m a -> WriterT w m () Source #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (WriterT w m) Source # |

Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a Source #

takeOptional :: WriterT w m a -> WriterT w m (Maybe a) Source #

takeMany :: WriterT w m a -> WriterT w m [a] Source #

takeSome :: WriterT w m a -> WriterT w m [a] Source #

concatAll :: Monoid a => WriterT w m a -> WriterT w m a Source #

skipAll :: WriterT w m a -> WriterT w m () Source #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (RWST r w s m) Source # |

Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a Source #

takeOptional :: RWST r w s m a -> RWST r w s m (Maybe a) Source #

takeMany :: RWST r w s m a -> RWST r w s m [a] Source #

takeSome :: RWST r w s m a -> RWST r w s m [a] Source #

concatAll :: Monoid a => RWST r w s m a -> RWST r w s m a Source #

skipAll :: RWST r w s m a -> RWST r w s m () Source #

(MonadPlus m, DeterministicParsing m, Monoid w) => DeterministicParsing (RWST r w s m) Source # |

Instance details

Defined in Text.Parser.Deterministic

Methods

(<<|>) :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a Source #

takeOptional :: RWST r w s m a -> RWST r w s m (Maybe a) Source #

takeMany :: RWST r w s m a -> RWST r w s m [a] Source #

takeSome :: RWST r w s m a -> RWST r w s m [a] Source #

concatAll :: Monoid a => RWST r w s m a -> RWST r w s m a Source #

skipAll :: RWST r w s m a -> RWST r w s m () Source #