drasil-lang-0.1.60.0: A framework for code and document generation for scientific software - Language SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Drasil.Expr.Development

Synopsis

Documentation

data Expr where Source #

Expression language where all terms are supposed to be 'well understood' (i.e., have a definite meaning). Right now, this coincides with "having a definite value", but should not be restricted to that.

Constructors

Lit :: Literal -> Expr

Brings a literal into the expression language.

AssocA :: AssocArithOper -> [Expr] -> Expr

Takes an associative arithmetic operator with a list of expressions.

AssocB :: AssocBoolOper -> [Expr] -> Expr

Takes an associative boolean operator with a list of expressions.

C :: UID -> Expr

C stands for Chunk, for referring to a chunk in an expression. Implicitly assumes that the chunk has a symbol.

FCall :: UID -> [Expr] -> Expr

Function applications.

Case :: Completeness -> [(Expr, Relation)] -> Expr

For multi-case expressions, each pair represents one case.

Matrix :: [[Expr]] -> Expr

Represents a matrix of expressions.

UnaryOp :: UFunc -> Expr -> Expr

Unary operation for most functions (eg. sin, cos, log, etc.).

UnaryOpB :: UFuncB -> Expr -> Expr

Unary operation for Bool -> Bool operations.

UnaryOpVV :: UFuncVV -> Expr -> Expr

Unary operation for Vector -> Vector operations.

UnaryOpVN :: UFuncVN -> Expr -> Expr

Unary operation for Vector -> Number operations.

ArithBinaryOp :: ArithBinOp -> Expr -> Expr -> Expr

Binary operator for arithmetic between expressions (fractional, power, and subtraction).

BoolBinaryOp :: BoolBinOp -> Expr -> Expr -> Expr

Binary operator for boolean operators (implies, iff).

EqBinaryOp :: EqBinOp -> Expr -> Expr -> Expr

Binary operator for equality between expressions.

LABinaryOp :: LABinOp -> Expr -> Expr -> Expr

Binary operator for indexing two expressions.

OrdBinaryOp :: OrdBinOp -> Expr -> Expr -> Expr

Binary operator for ordering expressions (less than, greater than, etc.).

VVVBinaryOp :: VVVBinOp -> Expr -> Expr -> Expr

Binary operator for Vector x Vector -> Vector operations (cross product).

VVNBinaryOp :: VVNBinOp -> Expr -> Expr -> Expr

Binary operator for Vector x Vector -> Number operations (dot product).

NVVBinaryOp :: NVVBinOp -> Expr -> Expr -> Expr

Binary operator for Expr x Vector -> Vector operations (scaling).

Operator :: AssocArithOper -> DiscreteDomainDesc Expr Expr -> Expr -> Expr

Operators are generalized arithmetic operators over a DomainDesc of an Expr. Could be called BigOp. ex: Summation is represented via Add over a discrete domain.

RealI :: UID -> RealInterval Expr Expr -> Expr

A different kind of IsIn. A UID is an element of an interval.

Instances

Instances details
CanGenCode Expr Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Convert

ExprC Expr Source # 
Instance details

Defined in Language.Drasil.Expr.Class

Methods

lit :: Literal -> Expr Source #

($=) :: Expr -> Expr -> Expr Source #

($!=) :: Expr -> Expr -> Expr Source #

($<) :: Expr -> Expr -> Expr Source #

($>) :: Expr -> Expr -> Expr Source #

($<=) :: Expr -> Expr -> Expr Source #

($>=) :: Expr -> Expr -> Expr Source #

($.) :: Expr -> Expr -> Expr Source #

addI :: Expr -> Expr -> Expr Source #

addRe :: Expr -> Expr -> Expr Source #

mulI :: Expr -> Expr -> Expr Source #

mulRe :: Expr -> Expr -> Expr Source #

($-) :: Expr -> Expr -> Expr Source #

($/) :: Expr -> Expr -> Expr Source #

($^) :: Expr -> Expr -> Expr Source #

($=>) :: Expr -> Expr -> Expr Source #

($<=>) :: Expr -> Expr -> Expr Source #

($&&) :: Expr -> Expr -> Expr Source #

($||) :: Expr -> Expr -> Expr Source #

abs_ :: Expr -> Expr Source #

neg :: Expr -> Expr Source #

log :: Expr -> Expr Source #

ln :: Expr -> Expr Source #

sqrt :: Expr -> Expr Source #

sin :: Expr -> Expr Source #

cos :: Expr -> Expr Source #

tan :: Expr -> Expr Source #

sec :: Expr -> Expr Source #

csc :: Expr -> Expr Source #

cot :: Expr -> Expr Source #

arcsin :: Expr -> Expr Source #

arccos :: Expr -> Expr Source #

arctan :: Expr -> Expr Source #

exp :: Expr -> Expr Source #

dim :: Expr -> Expr Source #

norm :: Expr -> Expr Source #

negVec :: Expr -> Expr Source #

not_ :: Expr -> Expr Source #

idx :: Expr -> Expr -> Expr Source #

defint :: Symbol -> Expr -> Expr -> Expr -> Expr Source #

defsum :: Symbol -> Expr -> Expr -> Expr -> Expr Source #

defprod :: Symbol -> Expr -> Expr -> Expr -> Expr Source #

realInterval :: HasUID c => c -> RealInterval Expr Expr -> Expr Source #

euclidean :: [Expr] -> Expr Source #

cross :: Expr -> Expr -> Expr Source #

vScale :: Expr -> Expr -> Expr Source #

vAdd :: Expr -> Expr -> Expr Source #

vSub :: Expr -> Expr -> Expr Source #

completeCase :: [(Expr, Expr)] -> Expr Source #

incompleteCase :: [(Expr, Expr)] -> Expr Source #

matrix :: [[Expr]] -> Expr Source #

apply :: (HasUID f, HasSymbol f) => f -> [Expr] -> Expr Source #

sy :: (HasUID c, HasSymbol c) => c -> Expr Source #

Express Expr Source #

Rewriting Exprs using the ModelExpr language.

Instance details

Defined in Language.Drasil.ExprClasses

LiteralC Expr Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

Eq Expr Source #

Expressions are equal if their constructors and contents are equal.

TODO: This needs to add more equality checks

Instance details

Defined in Language.Drasil.Expr.Lang

Methods

(==) :: Expr -> Expr -> Bool #

(/=) :: Expr -> Expr -> Bool #

Typed Expr Space Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

RequiresChecking DifferentialModel Expr Space Source # 
Instance details

Defined in Language.Drasil.Chunk.DifferentialModel

RequiresChecking (QDefinition Expr) Expr Space Source # 
Instance details

Defined in Language.Drasil.Chunk.Eq

data UFunc Source #

Unary functions (abs, log, ln, sin, etc.).

Constructors

Abs 
Log 
Ln 
Sin 
Cos 
Tan 
Sec 
Csc 
Cot 
Arcsin 
Arccos 
Arctan 
Exp 
Sqrt 
Neg 

Instances

Instances details
Show UFunc Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

Methods

showsPrec :: Int -> UFunc -> ShowS #

show :: UFunc -> String #

showList :: [UFunc] -> ShowS #

Eq UFunc Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

Methods

(==) :: UFunc -> UFunc -> Bool #

(/=) :: UFunc -> UFunc -> Bool #

data UFuncB Source #

Bool -> Bool operators.

Constructors

Not 

Instances

Instances details
Eq UFuncB Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

Methods

(==) :: UFuncB -> UFuncB -> Bool #

(/=) :: UFuncB -> UFuncB -> Bool #

data UFuncVV Source #

Vector -> Vector operators.

Constructors

NegV 

Instances

Instances details
Eq UFuncVV Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

Methods

(==) :: UFuncVV -> UFuncVV -> Bool #

(/=) :: UFuncVV -> UFuncVV -> Bool #

data UFuncVN Source #

Vector -> Number operators.

Constructors

Norm 
Dim 

Instances

Instances details
Eq UFuncVN Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

Methods

(==) :: UFuncVN -> UFuncVN -> Bool #

(/=) :: UFuncVN -> UFuncVN -> Bool #

data ArithBinOp Source #

Arithmetic operators (fractional, power, and subtraction).

Constructors

Frac 
Pow 
Subt 

Instances

Instances details
Eq ArithBinOp Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

data BoolBinOp Source #

Conditional and Biconditional operators (Expressions can imply one another, or exist if and only if another expression exists).

Constructors

Impl 
Iff 

Instances

Instances details
Eq BoolBinOp Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

data EqBinOp Source #

Equality operators (equal or not equal).

Constructors

Eq 
NEq 

Instances

Instances details
Eq EqBinOp Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

Methods

(==) :: EqBinOp -> EqBinOp -> Bool #

(/=) :: EqBinOp -> EqBinOp -> Bool #

data LABinOp Source #

Index operator.

Constructors

Index 

Instances

Instances details
Eq LABinOp Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

Methods

(==) :: LABinOp -> LABinOp -> Bool #

(/=) :: LABinOp -> LABinOp -> Bool #

data OrdBinOp Source #

Ordered binary operators (less than, greater than, less than or equal to, greater than or equal to).

Constructors

Lt 
Gt 
LEq 
GEq 

Instances

Instances details
Eq OrdBinOp Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

data VVVBinOp Source #

Vector x Vector -> Vector binary operations (cross product, addition, subtraction).

Constructors

Cross 
VAdd 
VSub 

Instances

Instances details
Eq VVVBinOp Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

data VVNBinOp Source #

Vector x Vector -> Number binary operations (dot product).

Constructors

Dot 

Instances

Instances details
Eq VVNBinOp Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

data NVVBinOp Source #

Number x Vector -> Vector binary operations (scaling).

Constructors

Scale 

Instances

Instances details
Eq NVVBinOp Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

data AssocArithOper Source #

Associative operators (adding and multiplication). Also specifies whether it is for integers or for real numbers.

Constructors

AddI 
AddRe 
MulI 
MulRe 

Instances

Instances details
Eq AssocArithOper Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

data AssocBoolOper Source #

Associative boolean operators (and, or).

Constructors

And 
Or 

Instances

Instances details
Eq AssocBoolOper Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

data Completeness Source #

For case expressions (either complete or incomplete).

Constructors

Complete 
Incomplete 

Instances

Instances details
Eq Completeness Source # 
Instance details

Defined in Language.Drasil.Expr.Lang

type Relation = Expr Source #

A relation is just an expression (Expr).

eDep :: Expr -> [UID] Source #

Get dependencies from an equation.

eNames :: Expr -> [UID] Source #

Generic traverse of all expressions that could lead to names.

eNames' :: Expr -> [UID] Source #

Generic traverse of all positions that could lead to eNames without functions. FIXME : this should really be done via post-facto filtering, but right now the information needed to do this is not available!

eNamesRI :: RealInterval Expr Expr -> [UID] Source #

Generic traversal of everything that could come from an interval to names (similar to eNames).

precA :: AssocArithOper -> Int Source #

precA - precedence for arithmetic-related Binary-Associative (Commutative) operators.

precB :: AssocBoolOper -> Int Source #

precB - precedence for boolean-related Binary-Associative (Commutative) operators.

eprec :: Expr -> Int Source #

eprec - Expression precedence.