netwire-5.0.3: Functional reactive programming library

Copyright | (c) 2013 Ertugrul Soeylemez
License | BSD3
Maintainer | Ertugrul Soeylemez <es@ertes.de>
Safe Haskell | Safe-Inferred
Language | Haskell2010

FRP.Netwire.Utils.Timeline

Contents

- Time lines for statistics wires
- Constructing time lines
- Linear sampling
- Staircase sampling

Description

Synopsis

- data Timeline t a
- insert :: Ord t => t -> a -> Timeline t a -> Timeline t a
- singleton :: t -> a -> Timeline t a
- union :: Ord t => Timeline t a -> Timeline t a -> Timeline t a
- linAvg :: (Fractional a, Fractional t, Real t) => t -> t -> Timeline t a -> a
- linCutL :: (Fractional a, Fractional t, Real t) => t -> Timeline t a -> Timeline t a
- linCutR :: (Fractional a, Fractional t, Real t) => t -> Timeline t a -> Timeline t a
- linLookup :: (Fractional a, Fractional t, Real t) => t -> Timeline t a -> a
- scAvg :: (Fractional a, Real t) => t -> t -> Timeline t a -> a
- scCutL :: Ord t => t -> Timeline t a -> Timeline t a
- scCutR :: Ord t => t -> Timeline t a -> Timeline t a
- scLookup :: Ord t => t -> Timeline t a -> a

# Time lines for statistics wires

data Timeline t a Source #

A time line is a non-empty set of samples together with time information.

#### Instances

Instances details

Functor (Timeline t) Source # |
Instance details Defined in FRP.Netwire.Utils.Timeline Methods fmap :: (a -> b) -> Timeline t a -> Timeline t b Source # (<$) :: a -> Timeline t b -> Timeline t a Source #
(Data t, Data a, Ord t) => Data (Timeline t a) Source # |

Instance details

Defined in FRP.Netwire.Utils.Timeline

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Timeline t a -> c (Timeline t a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Timeline t a) Source #

toConstr :: Timeline t a -> Constr Source #

dataTypeOf :: Timeline t a -> DataType Source #

dataCast1 :: Typeable t0 => (forall d. Data d => c (t0 d)) -> Maybe (c (Timeline t a)) Source #

dataCast2 :: Typeable t0 => (forall d e. (Data d, Data e) => c (t0 d e)) -> Maybe (c (Timeline t a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Timeline t a -> Timeline t a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Timeline t a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Timeline t a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Timeline t a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Timeline t a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Timeline t a -> m (Timeline t a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Timeline t a -> m (Timeline t a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Timeline t a -> m (Timeline t a) Source #

(Ord t, Read t, Read a) => Read (Timeline t a) Source # |
Instance details Defined in FRP.Netwire.Utils.Timeline Methods readsPrec :: Int -> ReadS (Timeline t a) Source # readList :: ReadS [Timeline t a] Source # readPrec :: ReadPrec (Timeline t a) Source # readListPrec :: ReadPrec [Timeline t a] Source #
(Show t, Show a) => Show (Timeline t a) Source # |
Instance details Defined in FRP.Netwire.Utils.Timeline Methods showsPrec :: Int -> Timeline t a -> ShowS Source # show :: Timeline t a -> String Source # showList :: [Timeline t a] -> ShowS Source #
(Eq t, Eq a) => Eq (Timeline t a) Source # |
Instance details Defined in FRP.Netwire.Utils.Timeline Methods (==) :: Timeline t a -> Timeline t a -> Bool Source # (/=) :: Timeline t a -> Timeline t a -> Bool Source #
(Ord t, Ord a) => Ord (Timeline t a) Source # |

Instance details

Defined in FRP.Netwire.Utils.Timeline

Methods

compare :: Timeline t a -> Timeline t a -> Ordering Source #

(<) :: Timeline t a -> Timeline t a -> Bool Source #

(<=) :: Timeline t a -> Timeline t a -> Bool Source #

(>) :: Timeline t a -> Timeline t a -> Bool Source #

(>=) :: Timeline t a -> Timeline t a -> Bool Source #

max :: Timeline t a -> Timeline t a -> Timeline t a Source #

min :: Timeline t a -> Timeline t a -> Timeline t a Source #

# Constructing time lines

insert :: Ord t => t -> a -> Timeline t a -> Timeline t a Source #

Insert the given data point.

singleton :: t -> a -> Timeline t a Source #

Singleton timeline with the given point.

union :: Ord t => Timeline t a -> Timeline t a -> Timeline t a Source #

Union of two time lines. Right-biased.

# Linear sampling

linAvg :: (Fractional a, Fractional t, Real t) => t -> t -> Timeline t a -> a Source #

Linearly interpolate the points in the time line, integrate the given time interval of the graph, divide by the interval length.

linCutL :: (Fractional a, Fractional t, Real t) => t -> Timeline t a -> Timeline t a Source #

Cut the timeline at the given point in time `t`, such that all samples up to but not including `t` are forgotten. The most recent sample before `t` is moved and interpolated accordingly.

linCutR :: (Fractional a, Fractional t, Real t) => t -> Timeline t a -> Timeline t a Source #

Cut the timeline at the given point in time `t`, such that all samples later than `t` are forgotten. The most recent sample after `t` is moved and interpolated accordingly.

linLookup :: (Fractional a, Fractional t, Real t) => t -> Timeline t a -> a Source #

Look up with linear sampling.

# Staircase sampling

scAvg :: (Fractional a, Real t) => t -> t -> Timeline t a -> a Source #

Integrate the given time interval of the staircase, divide by the interval length.

scCutL :: Ord t => t -> Timeline t a -> Timeline t a Source #

Cut the timeline at the given point in time `t`, such that all samples up to but not including `t` are forgotten. The most recent sample before `t` is moved accordingly.

scCutR :: Ord t => t -> Timeline t a -> Timeline t a Source #

Cut the timeline at the given point in time `t`, such that all samples later than `t` are forgotten. The earliest sample after `t` is moved accordingly.

scLookup :: Ord t => t -> Timeline t a -> a Source #

Look up on staircase.