linear-grammar-0.0.0.3: A simple grammar for building linear equations and inclusive inequalities.

Safe HaskellSafe
LanguageHaskell2010

Linear.Grammar

Contents

Synopsis

User-facing API

data LinAst Source

User-facing abstract syntax tree

(.+.) :: LinAst -> LinAst -> LinAst infixr 8 Source

class Coefficient x y where Source

Methods

(.*.) :: x -> y -> LinAst infixr 9 Source

multLin :: LinAst -> LinAst Source

Pushes ECoeff down the tree, leaving EAdd at the top level. After using this funciton, all ECoeff constructors LinAst parameter will be EVar.

Linear Expressions

data LinVar Source

Constructors

LinVar 

Fields

varName :: String
 
varCoeff :: Double
 

Instances

Eq LinVar Source 
Ord LinVar Source

For sorting tableaus

Show LinVar Source 

data LinExpr Source

Linear expressions suited for normal and standard form.

Constructors

LinExpr 

addLin :: LinAst -> LinExpr Source

Turns LinAst to LinExpr - should be done after multLin.

removeDupLin :: LinExpr -> LinExpr Source

Merged duplicate LinVars in a LinExpr. Should be used after addLin.

Linear Inequalities

(.==.) :: LinAst -> LinAst -> Ineq infixl 7 Source

(.<=.) :: LinAst -> LinAst -> Ineq infixl 7 Source

(.=>.) :: LinAst -> LinAst -> Ineq infixl 7 Source

Standard Form