prednote-0.36.0.4: Evaluate and display trees of predicates

Safe HaskellNone
LanguageHaskell2010

Prednote.Expressions

Description

Handles parsing of both infix and RPN Pred expressions.

Synopsis

Documentation

data ExprDesc Source

Is this an infix or RPN expression?

Constructors

Infix 
RPN 

Instances

data Token m a Source

A single type for both RPN tokens and infix tokens.

operand :: PredM m a -> Token m a Source

Creates Operands from Pred.

opAnd :: Token m a Source

The And operator

opOr :: Token m a Source

The Or operator

opNot :: Token m a Source

The Not operator

openParen :: Token m a Source

Open parentheses

closeParen :: Token m a Source

Close parentheses

parseExpression :: (Functor m, Monad m) => ExprDesc -> [Token m a] -> Either Error (PredM m a) Source

Parses expressions. Fails if the expression is nonsensical in some way (for example, unbalanced parentheses, parentheses in an RPN expression, or multiple stack values remaining.) Works by first changing infix expressions to RPN ones.