netwire-1.2.2: Arrowized FRP implementation

MaintainerErtugrul Soeylemez <es@ertes.de>

FRP.NetWire.Analyze

Contents

Description

Signal analysis.

Synopsis

Changes

diff :: forall a m. (Eq a, Monad m) => Wire m a (a, Time)Source

Emits an event, whenever the input signal changes. The event contains the last input value and the time elapsed since the last change.

Inhibits on no change.

Statistics

Average

avg :: forall m v. (Fractional v, Monad m, NFData v, Unbox v) => Int -> Wire m v vSource

Calculate the average of the signal over the given number of last samples. This wire has O(n) space complexity and O(1) time complexity.

If you need an average over all samples ever produced, consider using avgAll instead.

Never inhibits. Feedback by delay.

avgAll :: forall m v. (Fractional v, Monad m, NFData v) => Wire m v vSource

Calculate the average of the signal over all samples.

Please note that somewhat surprisingly this wire runs in constant space and is generally faster than avg, but most applications will benefit from averages over only the last few samples.

Never inhibits. Feedback by delay.

avgFps :: forall a m. Monad m => Int -> Wire m a DoubleSource

Calculate the average number of frames per virtual second for the last given number of frames.

Please note that this wire uses the clock, which you give the network using the stepping functions in FRP.NetWire.Session. If this clock doesn't represent real time, then the output of this wire won't either.

Never inhibits.

Peak

highPeak :: (Monad m, NFData a, Ord a) => Wire m a aSource

Return the high peak.

Never inhibits. Feedback by delay.

lowPeak :: (Monad m, NFData a, Ord a) => Wire m a aSource

Return the low peak.

Never inhibits. Feedback by delay.

peakBy :: forall a m. (Monad m, NFData a) => (a -> a -> Ordering) -> Wire m a aSource

Return the high peak with the given comparison function.

Never inhibits. Feedback by delay.