Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- generic2 :: (C w, C s) => (b -> a) -> (a -> b) -> Variable w s a -> Variable w s b -> T w s ()
- generic3 :: (C w, C s) => (b -> c -> a) -> (c -> a -> b) -> (a -> b -> c) -> Variable w s a -> Variable w s b -> Variable w s c -> T w s ()
- equ :: (C w, C s) => Variable w s a -> Variable w s a -> T w s ()
- pair :: (C w, C s) => Variable w s a -> Variable w s b -> Variable w s (a, b) -> T w s ()
- max :: (Ord a, C w, C s) => Variable w s a -> Variable w s a -> Variable w s a -> T w s ()
- add :: (Num a, C w, C s) => Variable w s a -> Variable w s a -> Variable w s a -> T w s ()
- mul :: (C a, C w, C s) => Variable w s a -> Variable w s a -> Variable w s a -> T w s ()
- square :: (Floating a, C w, C s) => Variable w s a -> Variable w s a -> T w s ()
- pow :: (Floating a, C w, C s) => Variable w s a -> Variable w s a -> Variable w s a -> T w s ()
Custom rules
generic2 :: (C w, C s) => (b -> a) -> (a -> b) -> Variable w s a -> Variable w s b -> T w s () Source #
generic3 :: (C w, C s) => (b -> c -> a) -> (c -> a -> b) -> (a -> b -> c) -> Variable w s a -> Variable w s b -> Variable w s c -> T w s () Source #
Common rules
pair :: (C w, C s) => Variable w s a -> Variable w s b -> Variable w s (a, b) -> T w s () Source #
You might be tempted to use the pair
rule to collect parameters
for rules with more than three arguments.
This is generally not a good idea since this way you lose granularity.
For building rules with more than three arguments,
please build according assignments with arg
and runApply
and bundle these assignments to rules.
This is the way, generic2
and generic3
work.
max :: (Ord a, C w, C s) => Variable w s a -> Variable w s a -> Variable w s a -> T w s () Source #
max x y z
means max x y = z
.
add :: (Num a, C w, C s) => Variable w s a -> Variable w s a -> Variable w s a -> T w s () Source #
add x y z
means x+y=z
.
mul :: (C a, C w, C s) => Variable w s a -> Variable w s a -> Variable w s a -> T w s () Source #
mul x y z
means x*y=z
.