polyparse-1.13.1: A variety of alternative parser combinator libraries.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.ParserCombinators.Poly.Result

Contents

- The parsing result type

Synopsis

- data Result z a
  - = Success z a
  - | Failure z String
  - | Committed (Result z a)
- resultToEither :: Result z a -> (Either String a, z)

# The parsing result type

data Result z a Source #

A return type like Either, that distinguishes not only between right and wrong answers, but also has commitment, so that a failure cannot be undone. This should only be used for writing very primitive parsers - really it is an internal detail of the library. The z type is the remaining unconsumed input.

Constructors

Success z a |
Failure z String |
Committed (Result z a) |

#### Instances

Instances details

Functor (Result z) Source # |
Instance details Defined in Text.ParserCombinators.Poly.Result Methods fmap :: (a -> b) -> Result z a -> Result z b Source # (<$) :: a -> Result z b -> Result z a Source #

resultToEither :: Result z a -> (Either String a, z) Source #

Convert a Result to an Either, paired with the remaining unconsumed input.