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

Copyright(c) Edward Kmett 2011-2014
LicenseBSD3
Maintainerekmett@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

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 where Source

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

Minimal complete definition

Nothing

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 b Source

The Prism for the Success constructor of Result

_Failure :: AsResult s s a a => Prism' s Doc Source

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 HasErr c where Source

Minimal complete definition

err

Instances

class Errable m where Source

Methods

raiseErr :: Err -> m a Source

Instances

explain :: Rendering -> Err -> Doc Source

Convert a location and an Err into a Doc

failed :: String -> Err Source

Generate a simple Err word-wrapping the supplied message.