ADPfusion-0.2.0.4: Efficient, high-level dynamic programming.

Safe HaskellNone

ADP.Fusion.Chr

Contents

Synopsis

Documentation

chr :: Vector v r => v r -> GChr r rSource

Parses a single character.

chrLeft :: Vector v x => v x -> GChr (Maybe x, x) xSource

Parses a single character and returns the character to the left in a strict Maybe.

chrLeftD :: Vector v x => x -> v x -> GChr (x, x) xSource

chrRight :: Vector v x => v x -> GChr (x, Maybe x) xSource

Parses a single character and returns the character to the right in a strict Maybe.

data GChr r x whereSource

A generic Character parser that reads a single character but allows passing additional information.

Constructors

GChr :: Vector v x => !(v x -> Int -> r) -> !(v x) -> GChr r x 

Instances

(Monad m, Elms ls Subword, MkStream m ls Subword) => MkStream m (:!: ls (GChr r x)) Subword 
(Monad m, TermElm m ts is) => TermElm m (Term ts (GChr r xs)) (:. is PointL)

NOTE This instance is currently the only one using an inline outer check. If This behaves well, it could be possible to put checks for valid indices inside the outerCheck function. (Currently disabled, as the compiler chokes on four-way alignments).

(Monad m, TermElm m ts is) => TermElm m (Term ts (GChr r xs)) (:. is Subword) 
Build (GChr r x) 
ValidIndex ls Subword => ValidIndex (:!: ls (GChr r x)) Subword 
Elms ls Subword => Elms (:!: ls (GChr r x)) Subword 
TermValidIndex ts is => TermValidIndex (Term ts (GChr r xs)) (:. is PointL) 
TermValidIndex ts is => TermValidIndex (Term ts (GChr r xs)) (:. is Subword) 

newtype ZeroOne r x Source

Wrapping a GChr to allow zero/one behaviour. Parses a character (or not) in a strict maybe.

Constructors

ZeroOne 

Fields

unZeroOne :: GChr r x
 

zoLeft :: Vector v x => v x -> ZeroOne (Maybe x, x) xSource

data GPeek r x Source

Generalized peek.

Constructors

GPeek !(Vector x -> Int -> r) !(Vector x) !(Int :!: Int) 

Instances

(Monad m, Unbox x, Elms ls Subword, MkStream m ls Subword) => MkStream m (:!: ls (GPeek r x)) Subword 
Build (GPeek r x) 
(ValidIndex ls Subword, Unbox x) => ValidIndex (:!: ls (GPeek r x)) Subword 
Elms ls Subword => Elms (:!: ls (GPeek r x)) Subword 

Peeking to the left

data PeekL x Source

Constructors

PeekL !(Vector x) 

Instances

(Monad m, Unbox x, Elms ls Subword, MkStream m ls Subword) => MkStream m (:!: ls (PeekL x)) Subword 
Build (PeekL x) 
(ValidIndex ls Subword, Unbox x) => ValidIndex (:!: ls (PeekL x)) Subword 
Elms ls Subword => Elms (:!: ls (PeekL x)) Subword 

Peeking to the right

data PeekR x Source

Constructors

PeekR !(Vector x) 

Instances

(Monad m, Unbox x, Elms ls Subword, MkStream m ls Subword) => MkStream m (:!: ls (PeekR x)) Subword 
Build (PeekR x) 
(ValidIndex ls Subword, Unbox x) => ValidIndex (:!: ls (PeekR x)) Subword 
Elms ls Subword => Elms (:!: ls (PeekR x)) Subword