Freckle


Sample

Namespace: Freckle

Based on Behavior, Sample generates values from a span of time rather than a single time

Nested types and modules

ModuleDescription
ComputationalExpression

Setup for computational expression(Do Notation in haskell) for Sample

Functions and values

Function or valueDescription
bind f m
Signature: f:('a -> Sample<'b>) -> m:Sample<'a> -> Sample<'b>
Type parameters: 'a, 'b

Binds a sample function into another sample

join sample p
Signature: sample:Sample<Sample<'a>> -> p:Period -> 'a
Type parameters: 'a

Joins nested samples

map f sample
Signature: f:('a -> 'b) -> sample:Sample<'a> -> Sample<'b>
Type parameters: 'a, 'b

Maps a sample from one result to another

period
Signature: Sample<Period>

Get the period of sample (it's just the id function)

pure' a
Signature: a:'a -> Sample<'a>
Type parameters: 'a

Get a sample from a value (it's just the const function)

realise p s
Signature: p:Period -> s:Sample<'a> -> 'a
Type parameters: 'a

Provided a period a Sample will generate a value. Remember for impure Samples, if the period finishes in the past then the program can't magically go back in time and undo things.

sampleForever clock sampler state
Signature: clock:Clock -> sampler:('s -> Sample<Async<'s>>) -> state:'s -> Async<'?7285>
Type parameters: 's, '?7285

Samples the same sample function forever transfering the state to the next sample

sampleUntil clock stopFunc sampler state
Signature: clock:Clock -> stopFunc:('s -> bool) -> sampler:('s -> Sample<Async<'s>>) -> state:'s -> Async<'s>
Type parameters: 's

Samples the sample function until the stop function is satisfied, then returns the last state

Fork me on GitHub