invertible-syntax-poly-0.1.0.1: Extends invertible-syntax library capable to use parameterized token type.

Copyright2012 Kei Hibino, 2010-11 University of Marburg
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell98

Text.Syntax.Poly.Class

Description

This module contains type classes for invertible syntax.

Synopsis

Documentation

class ProductFunctor f where Source

Apply IsoFunctor to another argument with uncurried style.

Methods

(<*>) :: f alpha -> f beta -> f (alpha, beta) infixr 6 Source

Instances

ProductFunctor (Printer tok) Source

ProductFunctor instance for Printer. Just print sequential.

class IsoAlternative f where Source

Monoid class for IsoFunctor

Methods

(<||>) :: f alpha -> f alpha -> f alpha infixr 3 Source

like MonadPlus (mplus) or Alternative ((<|>))

empty :: f alpha Source

Instances

IsoAlternative (Printer tok) Source

IsoAlternative instance for Printer. Print first or second.

class IsoAlternative f => TryAlternative f where Source

Support try for combinators which semantics is like Parsec

Minimal complete definition

Nothing

Methods

try :: f alpha -> f alpha Source

This method should be implemented for combinators which semantics is not full-backtracking like parsec. ex. try = Text.Parsec.try

(<|>) :: f alpha -> f alpha -> f alpha infixr 3 Source

This method should be implemented for combinators which semantics is not full-backtracking like parsec. ex. p | q = try p || q

class (IsoFunctor delta, ProductFunctor delta, IsoAlternative delta, TryAlternative delta) => AbstractSyntax delta where Source

Syntax abstraction.

Minimal complete definition

syntax

Methods

syntax :: Eq alpha => alpha -> delta alpha Source

Lift a value.

syntaxError :: String -> delta alpha Source

Instances

AbstractSyntax (Printer tok) Source

AbstractSyntax instance for Printer. Match parsed result and success.

class AbstractSyntax delta => Syntax tok delta | delta -> tok where Source

Syntax abstraction with token type tok.

Methods

token :: delta tok Source

Get a token from stream.

Instances

Eq tok => Syntax tok (Printer tok) Source

Syntax instance for Printer. Print token into singleton.

Eq tok => Syntax tok (Parser tok) Source 
Eq tok => Syntax tok (Parser tok) Source 
Eq tok => Syntax tok (Parser tok) Source 
Eq tok => Syntax tok (Parser tok) Source 
Eq tok => Syntax tok (Parser tok) Source