Safe Haskell | None |
---|
- data T s a
- constant :: a -> T s a
- fromVariable :: Variable s a -> T s a
- fromRule1 :: (Variable s a -> M s ()) -> T s a
- fromRule2 :: (Variable s a -> Variable s b -> M s ()) -> T s a -> T s b
- fromRule3 :: (Variable s a -> Variable s b -> Variable s c -> M s ()) -> T s a -> T s b -> T s c
- data Apply s f
- arg :: T s a -> Apply s (Variable s a)
- runApply :: Apply s (Variable s a -> M s ()) -> T s a
- (=:=) :: Eq a => T s a -> T s a -> M s ()
- (=!=) :: Eq a => T s a -> T s a -> T s a
- sqr :: Floating a => T s a -> T s a
- sqrt :: Floating a => T s a -> T s a
- max :: Ord a => T s a -> T s a -> T s a
- maximum :: Ord a => [T s a] -> T s a
- pair :: T s a -> T s b -> T 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 => Fractional (T s a) | |
Fractional a => Num (T s a) |
Construct primitive expressions
fromVariable :: Variable s a -> T s aSource
Operators from rules with small numbers of arguments
fromRule3 :: (Variable s a -> Variable s b -> Variable s c -> M s ()) -> T s a -> T s b -> T s cSource
Operators from rules with any number of arguments
arg :: T s a -> Apply s (Variable 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!