iteratee-parsec-0.0.6: Package allowing parsec parser initeratee

Portabilityportable
Stabilitynone
Maintaineruzytkownik2@gmail.com

Text.Parsec.Iteratee.LinkedList

Description

Module providing simple implementation based on mutable linked list. It is optimised for longer parsers.

Synopsis

Documentation

class Monad m => Reference r m where

Class connecting mutable variable and monad it exists in.

Methods

newRef

Arguments

:: a

An initial value

-> m (r a) 

Create new reference.

readRef

Arguments

:: r a

Reference

-> m a 

Reads a reference.

writeRef

Arguments

:: r a

Reference

-> a

New value

-> m () 

Write to reference.

modifyRef

Arguments

:: r a

Reference

-> (a -> m (a, b))

Computation

-> m b

Result of computation

Modify the reference. Default implementation is provided but it MUST be overloaded if the reference is atomic to provide an atomic write.

data (Monad m, Reference r m) => Cursor r m s el Source

Cursor holds current value and reference to possible next cursor

Instances

(Monad m, Nullable s, Reference r m, ListLike s el) => Stream (Cursor r m s el) (Iteratee s m) el 

data (Monad m, Reference r m, ListLike s el) => NextCursor r m s el Source

Specify the 3 possible states of next cursor - existence, non-existence and not being evaluated

mkCursor :: (Monad m, Reference r m, ListLike s el) => m (Cursor r m s el)Source

Creates new cursor

parsecIterateeSource

Arguments

:: (Monad m, Reference r m, Nullable c, ListLike c el) 
=> ParsecT (Cursor r m c el) u (Iteratee c m) a

Parser to run

-> u

A user state

-> SourceName

Source name

-> Iteratee c m (Either ParseError a) 

Runs parser. If it suceed the remaining part of stream stands in stream, however if it fails the stream is not in defined state.

safeParsecIterateeSource

Arguments

:: (Monad m, Reference r m, Nullable c, ListLike c el) 
=> ParsecT (Cursor r m c el) u (Iteratee c m) a

Parser to run

-> u

A user state

-> SourceName

Source name

-> Iteratee c m (Either ParseError a) 

Runs parser. If it suceed the remaining part of stream stands in stream, however if it fails everything stands in stream.