Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- data T var w s a
- constant :: (Var var, Monoid w) => a -> T var w s a
- fromVariable :: var w s a -> T var w s a
- fromRule1 :: (Var var, Monoid w) => (var w s a -> T w s ()) -> T var w s a
- fromRule2 :: (Var var, Monoid w) => (var w s a -> var w s b -> T w s ()) -> T var w s a -> T var w s b
- fromRule3 :: (Var var, Monoid w) => (var w s a -> var w s b -> var w s c -> T w s ()) -> T var w s a -> T var w s b -> T var w s c
- data Apply w s f
- arg :: T var w s a -> Apply w s (var w s a)
- runApply :: (Var var, Monoid w) => Apply w s (var w s a -> T w s ()) -> T var w s a
- (=:=) :: (Var var, Monoid w) => T var w s a -> T var w s a -> T w s ()
- (=!=) :: (Var var, Monoid w) => T var w s a -> T var w s a -> T var w s a
- sqr :: (Floating a, Var var, Monoid w) => T var w s a -> T var w s a
- sqrt :: (Floating a, Var var, Monoid w) => T var w s a -> T var w s a
- max :: (Ord a, Var var, Monoid w) => T var w s a -> T var w s a -> T var w s a
- maximum :: (Ord a, Var var, Monoid w) => [T var w s a] -> T var w s a
- pair :: (Var var, Monoid w) => T var w s a -> T var w s b -> T var w s (a, b)
Documentation
An expression is defined by a set of equations and the variable at the top-level. The value of the expression equals the value of the top variable.
(Fractional a, Var var, Monoid w) => Fractional (T var w s a) Source # | |
(Fractional a, Var var, Monoid w) => Num (T var w s a) Source # | |
Construct primitive expressions
constant :: (Var var, Monoid w) => a -> T var w s a Source #
Make a constant expression of a simple numeric value.
fromVariable :: var w s a -> T var w s a Source #
Operators from rules with small numbers of arguments
fromRule2 :: (Var var, Monoid w) => (var w s a -> var w s b -> T w s ()) -> T var w s a -> T var w s b Source #
fromRule3 :: (Var var, Monoid w) => (var w s a -> var w s b -> var w s c -> T w s ()) -> T var w s a -> T var w s b -> T var w s c Source #
Operators from rules with any number of arguments
arg :: T var w s a -> Apply w s (var w s a) Source #
This function allows to generalize fromRule2
and fromRule3
to more arguments
using Applicative
combinators.
Example:
fromRule3 rule x y = runApply $ liftA2 rule (arg x) (arg y) = runApply $ pure rule <*> arg x <*> arg y
Building rules with arg
provides more granularity
than using auxiliary pair
rules!