Copyright | (c) Michael Szvetits 2020 |
---|---|

License | BSD3 (see the file LICENSE) |

Maintainer | typedbyte@qualified.name |

Stability | stable |

Portability | portable |

Safe Haskell | Safe |

Language | Haskell2010 |

This module provides convenience functions to connect cells which hold numeric values.

## Synopsis

- plus :: Num a => Cell s a -> Cell s a -> Cell s a -> ST s ()
- minus :: Num a => Cell s a -> Cell s a -> Cell s a -> ST s ()
- times :: Num a => Cell s a -> Cell s a -> Cell s a -> ST s ()
- timesWith :: Num a => (a -> a -> a) -> Cell s a -> Cell s a -> Cell s a -> ST s ()
- abs :: Num a => Cell s a -> Cell s a -> ST s ()
- absWith :: Num a => (a -> a) -> Cell s a -> Cell s a -> ST s ()
- negate :: Num a => Cell s a -> Cell s a -> ST s ()
- signum :: Num a => Cell s a -> Cell s a -> ST s ()
- signumWith :: Num a => (a -> a) -> Cell s a -> Cell s a -> ST s ()

# Documentation

plus :: Num a => Cell s a -> Cell s a -> Cell s a -> ST s () Source #

`plus a b c`

connects three cells using the following propagation schema:

`a + b`

is propagated to`c`

if`a`

or`b`

changes.`c - b`

is propagated to`a`

if`b`

or`c`

changes.`c - a`

is propagated to`b`

if`a`

or`c`

changes.

minus :: Num a => Cell s a -> Cell s a -> Cell s a -> ST s () Source #

`minus a b c`

connects three cells using the following propagation schema:

`a - b`

is propagated to`c`

if`a`

or`b`

changes.`b + c`

is propagated to`a`

if`b`

or`c`

changes.`a - c`

is propagated to`b`

if`a`

or`c`

changes.

times :: Num a => Cell s a -> Cell s a -> Cell s a -> ST s () Source #

`times a b c`

connects three cells using the following propagation schema:

`a * b`

is propagated to`c`

if`a`

or`b`

changes.

timesWith :: Num a => (a -> a -> a) -> Cell s a -> Cell s a -> Cell s a -> ST s () Source #

`timesWith divOp a b c`

connects three cells using the following propagation schema:

`a * b`

is propagated to`c`

if`a`

or`b`

changes.`divOp c b`

is propagated to`a`

if`b`

or`c`

changes.`divOp c a`

is propagated to`b`

if`a`

or`c`

changes.

abs :: Num a => Cell s a -> Cell s a -> ST s () Source #

`abs a b`

connects two cells using the following propagation schema:

`|a|`

is propagated to`b`

if`a`

changes.

absWith :: Num a => (a -> a) -> Cell s a -> Cell s a -> ST s () Source #

`absWith inv a b`

connects two cells using the following propagation schema:

`|a|`

is propagated to`b`

if`a`

changes.`inv b`

is propagated to`a`

if`b`

changes.

negate :: Num a => Cell s a -> Cell s a -> ST s () Source #

`negate a b`

connects two cells using the following propagation schema:

`-a`

is propagated to`b`

if`a`

changes.`-b`

is propagated to`a`

if`b`

changes.