Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Basic types and convenience functions for constructing your own terms and expression trees.
Synopsis
- data Term
- = Measured {
- numSigFigs :: Integer
- value :: BigDecimal
- | Constant Rational
- = Measured {
- data Op
- data Expr
- data Function
- measured :: Integer -> Rational -> Term
- constant :: Rational -> Term
- l :: Term -> Expr
- lMeasured :: Integer -> Rational -> Expr
- lConstant :: Rational -> Expr
- add :: [Expr] -> Expr
- sub :: [Expr] -> Expr
- mul :: [Expr] -> Expr
- div :: [Expr] -> Expr
- exp :: Expr -> Expr -> Expr
- apply :: Function -> Expr -> Expr
Documentation
The basic datatype to represent measurements, constant terms, and evaluation results
Measured | A measured value with a finite number of significant figures and an associated value |
| |
Constant Rational | A constant value with infinite significant figures |
The types of (infix) operators
A datatype to represent (not-yet-evaluated) expressions. Use parse
to create such an expression from text.
A datatype representing the supported functions.
Instances
Bounded Function Source # | |
Enum Function Source # | |
Show Function Source # | |
Eq Function Source # | |
Creating Terms and Expression Trees
lMeasured :: Integer -> Rational -> Expr Source #
Create a literal node and construct the Measured
value argument at the same time. Convenience function.
lConstant :: Rational -> Expr Source #
Create a literal node and construct the Constant
value argument at the same time. Convenience function.