trifecta-1.1: 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 p f 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 :: Overloaded p f s t (Result a) (Result b)Source

Instances

AsResult p f (Result a) (Result b) a b 

_Success :: (AsResult p f s t a b, Choice p, Applicative f) => Overloaded p f s t a bSource

The Prism for the Success constructor of Result

_Failure :: (AsResult p f s s a a, Choice p, Applicative f) => Overloaded' p f 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 

Fields

_reason :: Maybe Doc
 
_footnotes :: [Doc]
 
_expected :: Set String
 

Instances

Monoid Err 
Semigroup Err 
HasErr Err 

class HasErr t whereSource

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.