LanguageExt.Core

LanguageExt.Core Effects Source

Contents

class Source <A> Source #

A source of a stream

A Source manages a queue of events that it distributes to its subscribers asynchronously.

Each subscriber runs on the same thread as the event-distributor. So, if you have multiple subscribers they will be processed serially for each event. If you want the subscribers to run in parallel then you must lift the IO monad when calling Subscribe and forkIO the stream. This gives fine-grained control over when to run events in parallel.

Parameters

type A

Value type flowing downstream

Methods

method IO<Source<A>> Start () Source #

Start a new source

Parameters

returns

A source in an IO computation

method StreamT<M, A> Await <M> () Source #

where M : Monad<M>

Subscribe to the source and await the values

Each subscriber runs on the same thread as the event-distributor. So, if you have multiple subscribers they will be processed serially for each event. If you want the subscribers to run in parallel then you must lift the IO monad when calling Subscribe and forkIO the stream. This gives fine-grained control over when to run events in parallel.

Parameters

type M

Monad type lifted into the stream

returns

StreamT monad transformer that will get the values coming downstream

method IO<Unit> Post (A value) Source #

Post a value to flow downstream

Parameters

param value

Value

returns

IO effect

method IO<Unit> Complete () Source #

Post a completion event to flow downstream to shut down the Source and its subscribers

Parameters

returns

IO effect

method void Dispose () Source #

Dispose