cattrap-0.6.0.0: Lays out boxes according to the CSS Box Model.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Graphics.Layout.Arithmetic

Description

(Unused) Parses & evaluates calc() expressions. Implemented using The Shunting Yard Algorithm.

Synopsis

Documentation

data Opcode n Source #

Parsed calc() expression. As a postfix arithmatic expression.

Constructors

Seq 
Add 
Subtract 
Multiply 
Divide 
Func Text 
Num n 

Instances

Instances details
Show n => Show (Opcode n) Source # 
Instance details

Defined in Graphics.Layout.Arithmetic

Methods

showsPrec :: Int -> Opcode n -> ShowS #

show :: Opcode n -> String #

showList :: [Opcode n] -> ShowS #

parseCalc :: [Token] -> [Opcode (Float, String)] -> [Opcode (Float, String)] Source #

Parse a calc() expression.

verifyCalc :: [Opcode (Float, String)] -> [Bool] -> Bool Source #

Verify that a parsed math expression can be properly evaluated.

evalCalc :: [Opcode Float] -> [Float] -> Float Source #

Evaluate a parsed calc() expression.

mapCalc :: (a -> b) -> [Opcode a] -> [Opcode b] Source #

Convert all numbers in an expression via the given callback.