trifecta-1.4.3: A modern parser combinator library with convenient diagnostics

Portabilitynon-portable
Stabilityexperimental
Maintainerekmett@gmail.com
Safe HaskellNone

Text.Trifecta.Result

Contents

Description

Results and Parse Errors

Synopsis

Parse Results

data Result a Source

The result of parsing. Either we succeeded or something went wrong.

Constructors

Success a 
Failure Doc 

class AsResult s t a b | s -> a, t -> b, s b -> t, t a -> s whereSource

A Prism that lets you embed or retrieve a Result in a potentially larger type.

Methods

_Result :: Prism s t (Result a) (Result b)Source

Instances

AsResult (Result a) (Result b) a b 

_Success :: AsResult s t a b => Prism s t a bSource

The Prism for the Success constructor of Result

_Failure :: AsResult s s a a => Prism' s DocSource

The Prism for the Failure constructor of Result

Parsing Errors

data Err Source

This is used to report an error. What went wrong, some supplemental docs and a set of things expected at the current location. This does not, however, include the actual location.

Constructors

Err 

class Errable m whereSource

Methods

raiseErr :: Err -> m aSource

Instances

explain :: Rendering -> Err -> DocSource

Convert a location and an Err into a Doc

failed :: String -> ErrSource

Generate a simple Err word-wrapping the supplied message.