Freckle


Feed

Namespace: Freckle

The feed module contains all functions necessary to work with feeds.

Nested types and modules

ModuleDescription
ComputationalExpression

Setup for computational expression(Do Notation in haskell) for Feed, to better understand how this works, consider two event streams firing after each other a computation is made each time,

Internal

This module contains internally used functions, these are suceptible to change even with minor updates. Is not recommended for use in a production environment.

Operator

Provide operator syntax for bind

Functions and values

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

The bind operator for the monad type class instance

bind_ f
Signature: f:('a -> Feed<unit>) -> Feed<'a> -> Feed<'a>
Type parameters: 'a

Bind but with the feed returned by the function ignored

choose f
Signature: f:('a -> 'b option) -> Feed<'a> -> Feed<'b>
Type parameters: 'a, 'b

Selects all events with the Value of Some

combine frA frB
Signature: frA:Feed<'a> -> frB:Feed<'a> -> Feed<'a>
Type parameters: 'a
dateTimed fr
Signature: fr:Feed<'?7404> -> Feed<DateTime * '?7404>
Type parameters: '?7404

Same as timeStamp but provides the time in DateTime

delay t fr
Signature: t:Time -> fr:Feed<'?7396> -> Feed<'?7396>
Type parameters: '?7396

delays events to an later sampling, it is recommended to be used together with discardFuture, as these events will still be present in the feed but just ignored by the sampling.

discardFuture fr
Signature: fr:Feed<'?7425> -> Sample<Feed<'?7425>>
Type parameters: '?7425

Discard all events occuring after the sample finish time, excluding events occuring exactly at the finish time

discardOlderExcl time fr
Signature: time:Time -> fr:Feed<'a> -> Feed<'a>
Type parameters: 'a

Discard events occuring before the specified time, excluding events occuring exactly at the time

discardOlderIncl time fr
Signature: time:Time -> fr:Feed<'a> -> Feed<'a>
Type parameters: 'a

Discard events occuring before the specified time, including events occuring exactly at the time

discardOutsideSample fr
Signature: fr:Feed<'?7429> -> Sample<Feed<'?7429>>
Type parameters: '?7429

Discards all events before the sample (inclusive) and all events after the sample (Exclusive)

discardPast fr
Signature: fr:Feed<'?7427> -> Sample<Feed<'?7427>>
Type parameters: '?7427

Discard all events occuring before the sample beginning time, including events occuring exactly at the beginning time

discardYoungerExcl time fr
Signature: time:Time -> fr:Feed<'a> -> Feed<'a>
Type parameters: 'a

Discard events occuring after the specified time, excluding events occuring exactly at the time

discardYoungerIncl time fr
Signature: time:Time -> fr:Feed<'a> -> Feed<'a>
Type parameters: 'a

Discard events occuring after the specified time, including events occuring exactly at the time

empty
Signature: Feed<'e>
Type parameters: 'e

Provides an empty feed with no events

every time
Signature: time:Time -> Sample<Feed<Time>>

Get a feed with events firing with an interval of the specified time, starting from the finish time of a Sample, continuing until origin Time. This is useful for making pull-based events.

everyUpto time
Signature: time:Time -> Sample<Feed<Time>>

Identical to every except does not guarantee all events are fired, if for instance a lagspike occurs.

filter predicate fr
Signature: predicate:('a -> bool) -> fr:Feed<'a> -> Feed<'a>
Type parameters: 'a

Get a new feed where all event values satisfy the predicate

foldPast f state fr
Signature: f:('s -> 'a -> 's) -> state:'s -> fr:Feed<'a> -> Sample<'s>
Type parameters: 's, 'a

Discards all events outside the sample, then folds the events from the past by applying the given accumulating function to the oldest events of the feed, Returning the a the last state as the result

groupBy f fr
Signature: f:('a -> 'a -> bool) -> fr:Feed<'a> -> Feed<Feed<'a>>
Type parameters: 'a

Groups elements together where f is satisfied

join fr
Signature: fr:Feed<Feed<'a>> -> Feed<'a>
Type parameters: 'a

Joins multiple feeds together. A white paper will be released to explain how exactly this function works

map f fr
Signature: f:('a -> 'b) -> fr:Feed<'a> -> Feed<'b>
Type parameters: 'a, 'b

Get a new feed where events are mapped from one value to another, retaining their current time

mapFoldPast f state fr
Signature: f:('s -> 'a -> 's * 'b) -> state:'s -> fr:Feed<'a> -> Sample<'s * Feed<'b>>
Type parameters: 's, 'a, 'b

Discards all events outside the sample, then folds and maps from the past

mapScan f s fr
Signature: f:('s -> 'a -> 's * 'b) -> s:'s -> fr:Feed<'a> -> Feed<'s * 'b>
Type parameters: 's, 'a, 'b
mapScanPast f state fr
Signature: f:('s -> 'a -> 's * 'b) -> state:'s -> fr:Feed<'a> -> Sample<Feed<'s * 'b>>
Type parameters: 's, 'a, 'b

Discards all events outside the sample, then scanMaps from the past

ofList l
Signature: l:(Time * '?7383) list -> Feed<'?7383>
Type parameters: '?7383

Transforms a list into a feed

partition f fr
Signature: f:('a -> bool) -> fr:Feed<'a> -> Feed<'a> * Feed<'a>
Type parameters: 'a

Partitions the feed into two feeds, the first satisfy the predicate and the second does not satisfy

plan fullFeed
Signature: fullFeed:Feed<Async<'a>> -> Sample<Async<Feed<'a>>>
Type parameters: 'a

Discards all events outside the sample, then combine all async computations into a single async computation with the result of a feed of the asyncs' results.

plan_ fr
Signature: fr:Feed<Async<'?7458>> -> Sample<Async<unit>>
Type parameters: '?7458

Same as plan but discard the feed of results

pulse pulsePerSecond
Signature: pulsePerSecond:int -> Sample<Feed<Time>>

Get a feed with events firing using the frequency of pulsePerSecond, starting from the finish time of a Sample, continuing until origin Time. This is useful for making pull-based events.

pulseUpto pulsePerSecond
Signature: pulsePerSecond:int -> Sample<Feed<Time>>

Identical to pulse except events outside the sampling resolution are ignored This is useful if old events that came about due to lag aren't necessary for operations to continue. e.g. when drawing the screen in a graphical application it would be wasteful to do multiple times. Just because of internal lag that prevented drawing last two updates.

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

Provides a feed with a single event at origin Time

push t a fr
Signature: t:Time -> a:'?7390 -> fr:Feed<'?7390> -> Feed<'?7390>
Type parameters: '?7390

Push an event with a specified time onto a feed. This function is safe and will maintain Temporal Monotonicity.

scan f s
Signature: f:('?7435 -> '?7436 -> '?7435) -> s:'?7435 -> Feed<'?7436> -> Feed<'?7435>
Type parameters: '?7435, '?7436

Return a new feed consisting of the results of applying the given accumulating function to the newests events of the feed

scanPast f state fr
Signature: f:('s -> 'a -> 's) -> state:'s -> fr:Feed<'a> -> Sample<Feed<'s>>
Type parameters: 's, 'a

Discards all events outside the sample, then scans the events from the past by applying the given accumulating function to the oldest events of the feed, Returning a feed of the results

singleton time evt
Signature: time:Time -> evt:'?7354 -> Feed<'?7354>
Type parameters: '?7354

Provides a feed with a single event at the specified time

skip n fr
Signature: n:int -> fr:Feed<'?7377> -> Feed<'?7377>
Type parameters: '?7377

Skip the first n events in feed and return the remaining events in a new feed

skipWhile f fr
Signature: f:('a -> bool) -> fr:Feed<'a> -> Feed<'a>
Type parameters: 'a

Discard events from the feed until the predicate is no longer satisfied

span p fr
Signature: p:('a -> bool) -> fr:Feed<'a> -> Feed<'a> * Feed<'a>
Type parameters: 'a

Span, applied to a predicate p and a feed, returns a tuple of feed where the first feed satisfy p and second element is the remainder of the list:

stick a fr
Signature: a:'a -> fr:Feed<'b> -> Feed<'a * 'b>
Type parameters: 'a, 'b

Attach a constant value to all events

take n fr
Signature: n:int -> fr:Feed<'?7375> -> Feed<'?7375>
Type parameters: '?7375

Take upto the first n events in a feed and return them in a new feed

takeWhile f fr
Signature: f:('a -> bool) -> fr:Feed<'a> -> Feed<'a>
Type parameters: 'a

Take events from the feed until the predicate is no longer satisfied

testLength n fr
Signature: n:int -> fr:Feed<'?7379> -> int
Type parameters: '?7379

Test the if a new have a certain count of events. This will return upto the specified count, depending on the actual count.

time fr
Signature: fr:Feed<'a> -> Feed<Time>
Type parameters: 'a

Overwrites the event value with the time of the event

timeStamp fr
Signature: fr:Feed<'a> -> Feed<Time * 'a>
Type parameters: 'a

Timestamps all event with their arrival time, changing the timestamp will not have an impact of their arrival time, see delay for this.

timeStampAsTicks fr
Signature: fr:Feed<'?7402> -> Feed<Ticks * '?7402>
Type parameters: '?7402

Same as timeStamp but provides the time in ticks

toList fr
Signature: fr:Feed<'?7381> -> (Time * '?7381) list
Type parameters: '?7381

Transforms a feed to list. Be careful when using this function as list is strict, and given Feeds can be possible trillions of events long when fully evaluated, this can lead to inefficient code.

transition f state allFeed
Signature: f:('s -> 'a -> Async<'s>) -> state:'s -> allFeed:Feed<'a> -> Sample<Async<'s>>
Type parameters: 's, 'a

Discard all events outside the sample, then from the past folds all the events of Feed<'a> using an async state transition into a single state

tryHead fr
Signature: fr:Feed<'a> -> 'a option
Type parameters: 'a

Attempt to get lastest event from the feed

weave f initA frB frA
Signature: f:('a -> 'b -> 'a) -> initA:'a -> frB:Feed<'b> -> frA:Feed<'a> -> Feed<'a>
Type parameters: 'a, 'b

A special combine function that takes the last event of Feed<'a> that is not older than an event from Feed<'b> and maps it with 'b. If no event in Feed<'a> is found then initA is used instead.

Active patterns

Active patternDescription
( |Head|Empty| ) feed
Signature: feed:Feed<'?7373> -> Choice<('?7373 * Feed<'?7373>),unit>
Type parameters: '?7373

Active pattern matching such that Head and Empty can be used in pattern matching

CompiledName: |Head|Empty|

Fork me on GitHub