parser-combinators-0.4.0: Lightweight package providing commonly useful parser combinators

Copyright© 2017 Mark Karpov
LicenseBSD 3 clause
MaintainerMark Karpov <markkarpov92@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Control.Applicative.Combinators.NonEmpty

Description

The module provides NonEmpty list variants of some of the functions from Control.Applicative.Combinators.

Since: 0.2.0

Synopsis

Documentation

some :: Alternative m => m a -> m (NonEmpty a) Source #

some p applies the parser p one or more times and returns a list of the values returned by p.

word = some letter

endBy1 :: Alternative m => m a -> m sep -> m (NonEmpty a) Source #

endBy1 p sep parses one or more occurrences of p, separated and ended by sep. Returns a non-empty list of values returned by p.

someTill :: Alternative m => m a -> m end -> m (NonEmpty a) Source #

someTill p end works similarly to manyTill p end, but p should succeed at least once.

See also: skipSome, skipSomeTill.

sepBy1 :: Alternative m => m a -> m sep -> m (NonEmpty a) Source #

sepBy1 p sep parses one or more occurrences of p, separated by sep. Returns a non-empty list of values returned by p.

sepEndBy1 :: Alternative m => m a -> m sep -> m (NonEmpty a) Source #

sepEndBy1 p sep parses one or more occurrences of p, separated and optionally ended by sep. Returns a non-empty list of values returned by p.