Freckle
Simple monadic Functional Reactive Programming for F#
PM> Install-Package Freckle
Quick Introduction
Namespace and referecing
1:
|
|
Setting up a sampler and running
Create a sampler that prints the timespan it samples over
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: |
|
Guaranteed Fixed interval updates
Create a sampler that counts every second from 0 and is resistentent to computer lagspike
1: 2: 3: 4: 5: 6: 7: 8: |
|
Best attempt Fixed interval updates
Creates a sampler that does something every second, but doesn't care if a step is skipped due to a lagspike
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: |
|
Listening to events
Listen to external events and print their content to the console
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: |
|
Further Reading
Tutorial contains a further explanation of this sample library.
-
API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.
Contributing and copyright
The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding a new public API, please also consider adding samples that can be turned into a documentation. You might also want to read the library design notes to understand how it works.
The library is available under Public Domain license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.
Full name: Index.sampler
Full name: Freckle.ComputationExpression.sample
module Sample
from Freckle
--------------------
type Sample<'a> = Period -> 'a
Full name: Freckle.Sample<_>
Full name: Freckle.Sample.period
{Ticks: Ticks;}
override ToString : unit -> string
static member between : a:Time -> b:Time -> Time
static member maxValue : Time
static member origin : Time
static member ofDateTime : d:DateTime -> Time
static member ofDays : days:int32 -> Time
static member ofHours : hour:int32 -> Time
static member ofMicroseconds : microSec:int32 -> Time
static member ofMilliseconds : ms:int32 -> Time
static member ofMinutes : min:int32 -> Time
static member ofSeconds : sec:int32 -> Time
static member ( + ) : t1:Time * t2:Time -> Time
static member ( - ) : t1:Time * t2:Time -> Time
static member ticks : t:Time -> Ticks
static member time : t:Ticks -> Time
static member toDateTime : t:Time -> DateTime
Full name: Freckle.Time
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
from Freckle
Full name: Freckle.SampleAsync.ofSample
Full name: Freckle.Sample.sampleForever
union case Clock.Clock: Async<Time> -> Clock
--------------------
module Clock
from Freckle.Clock
--------------------
module Clock
from Freckle
--------------------
type Clock = | Clock of Async<Time>
Full name: Freckle.Clock.Types.Clock
Full name: Freckle.Clock.Clock.systemUtc
module Async
from Freckle
--------------------
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task -> Async<unit>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken
Full name: Microsoft.FSharp.Control.Async
--------------------
type Async<'T>
Full name: Microsoft.FSharp.Control.Async<_>
Full name: Index.countSecondsSampler
union case Feed.Feed: LazyList<Time * 'e> -> Feed<'e>
--------------------
module Feed
from Freckle
--------------------
type Feed<'e> =
| Feed of LazyList<Time * 'e>
override ToString : unit -> string
Full name: Freckle.Feed<_>
Full name: Freckle.Feed.pulse
Full name: Freckle.Feed.foldPast
Full name: Index.render
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
Full name: Index.renderingSampler
Full name: Freckle.Feed.pulseUpto
Full name: Freckle.Feed.transition
Full name: Freckle.Clock.Clock.synchronized
module Mailbox
from Freckle
--------------------
type Mailbox<'e> =
{Post: 'e -> Async<unit>;
Read: Async<Feed<'e>>;
Clear: Async<unit>;
AwaitMail: Async<unit>;}
Full name: Freckle.Mailbox<_>
Full name: Freckle.Mailbox.createWithExpiration
| Never
| After of Time
Full name: Freckle.Expire
Full name: Freckle.ComputationExpression.sampleAsync
Full name: Freckle.Mailbox.read
Full name: Freckle.SampleAsync.ofAsync
Full name: Freckle.Mailbox.clear