propeller-0.1.0.0: A Simple Propagator Library

Copyright(c) Michael Szvetits 2020
LicenseBSD3 (see the file LICENSE)
Maintainertypedbyte@qualified.name
Stabilitystable
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Propagator.Num

Description

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

Synopsis

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.

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

signum a b connects two cells using the following propagation schema:

  • Prelude.signum a is propagated to b if a changes.

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

signumWith inv a b connects two cells using the following propagation schema:

  • Prelude.signum a is propagated to b if a changes.
  • inv b is propagated to a if b changes.