netwire-5.0.0: Functional reactive programming library

Maintainer Ertugrul Soeylemez Safe-Inferred

FRP.Netwire.Utils.Timeline

Description

Synopsis

# 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

 Typeable2 Timeline Functor (Timeline t) (Eq t, Eq a) => Eq (Timeline t a) (Data t, Data a, Ord t) => Data (Timeline t a) (Ord t, Ord a) => Ord (Timeline t a) (Ord t, Read t, Read a) => Read (Timeline t a) (Show t, Show a) => Show (Timeline t a)

# Constructing time lines

insert :: Ord t => t -> a -> Timeline t a -> Timeline t aSource

Insert the given data point.

singleton :: t -> a -> Timeline t aSource

Singleton timeline with the given point.

union :: Ord t => Timeline t a -> Timeline t a -> Timeline t aSource

Union of two time lines. Right-biased.

# Linear sampling

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

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 aSource

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 aSource

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 -> aSource

Look up with linear sampling.

# Staircase sampling

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

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

scCutL :: Ord t => t -> Timeline t a -> Timeline t aSource

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 aSource

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 -> aSource

Look up on staircase.