Copyright | (c) Hans Hoglund 2012-2014 |
---|---|

License | BSD-style |

Maintainer | hans@hanshoglund.se |

Stability | experimental |

Portability | non-portable (TF,GNTD) |

Safe Haskell | None |

Language | Haskell2010 |

- data Reactive a
- initial :: Reactive a -> a
- final :: Reactive a -> a
- intermediate :: Transformable a => Reactive a -> [Event a]
- discrete :: Reactive a -> Behavior a
- updates :: Reactive a -> [(Time, a)]
- occs :: Reactive a -> [Time]
- atTime :: Reactive a -> Time -> a
- switchR :: Time -> Reactive a -> Reactive a -> Reactive a
- trimR :: Monoid a => Span -> Reactive a -> Reactive a
- splitReactive :: Reactive a -> Either a ((a, Time), [Event a], (Time, a))
- continous :: Reactive (Segment a) -> Behavior a
- continousWith :: Segment (a -> b) -> Reactive a -> Behavior b
- sample :: [Time] -> Behavior a -> Reactive a

# Reactive type

Forms an applicative as per `Behavior`

, but only switches at discrete points.

Functor Reactive | |

Applicative Reactive | |

Monoid a => Monoid (Reactive a) | |

Semigroup a => Semigroup (Reactive a) | |

Wrapped (Reactive a) | |

IsDynamics a => IsDynamics (Reactive a) | |

IsPitch a => IsPitch (Reactive a) | |

IsInterval a => IsInterval (Reactive a) | |

Augmentable a => Augmentable (Reactive a) | |

Alterable a => Alterable (Reactive a) | |

Transformable (Reactive a) | |

Reversible (Reactive a) | |

Rewrapped (Reactive a) (Reactive b) | |

Typeable (* -> *) Reactive | |

type Unwrapped (Reactive a) = ([Time], Behavior a) |

# Query

intermediate :: Transformable a => Reactive a -> [Event a] Source

Get all intermediate values.

discrete :: Reactive a -> Behavior a Source

Realize a `Reactive`

value as a discretely changing behavior.

updates :: Reactive a -> [(Time, a)] Source

Get the time of all updates and the value switched to at this point.

# Construction

# Combine

switchR :: Time -> Reactive a -> Reactive a -> Reactive a Source

`switch t a b`

behaves as `a`

before time `t`

, then as `b`

.

# Split

splitReactive :: Reactive a -> Either a ((a, Time), [Event a], (Time, a)) Source

Split a reactive into events, as well as the values before and after the first/last update

# Sampling

continous :: Reactive (Segment a) -> Behavior a Source

Realize a `Reactive`

value as an continous behavior.