LanguageExt.Core ► Traits ► Monads ► MonadIO
Contents
- MonadIOExtensions
- Bind <M, A, B> ( this K<M, A> ma, Func<A, IO<B>> f)
- Bind <M, A, B> ( this IO<A> ma, Func<A, K<M, B>> f)
- SelectMany <M, A, B, C> (this K<M, A> ma, Func<A, IO<B>> bind, Func<A, B, C> project)
- SelectMany <M, A, B, C> (this IO<A> ma, Func<A, K<M, B>> bind, Func<A, B, C> project)
- ForkIO <M, A> (this K<M, A> ma, Option<TimeSpan> timeout = default)
- ForkIOMaybe <M, A> (this K<M, A> ma, Option<TimeSpan> timeout = default)
- MonadIO
- when <M> (K<M, bool> Pred, K<IO, Unit> Then)
- unless <M> (K<M, bool> Pred, K<IO, Unit> Then)
- liftIO <M, A> (IO<A> ma)
- liftIO <M, A> (K<IO, A> ma)
- envIO <M> ()
- token <M> ()
- tokenSource <M> ()
- syncContext <M> ()
- MonadIO <M>
class MonadIOExtensions Source #
Methods
method K<M, B> Bind <M, A, B> ( this K<M, A> ma, Func<A, IO<B>> f) Source #
Monad bind operation
method K<M, B> Bind <M, A, B> ( this IO<A> ma, Func<A, K<M, B>> f) Source #
Monad bind operation
method K<M, C> SelectMany <M, A, B, C> (this K<M, A> ma, Func<A, IO<B>> bind, Func<A, B, C> project) Source #
Monad bind operation
method K<M, C> SelectMany <M, A, B, C> (this IO<A> ma, Func<A, K<M, B>> bind, Func<A, B, C> project) Source #
Monad bind operation
method K<M, ForkIO<A>> ForkIO <M, A> (this K<M, A> ma, Option<TimeSpan> timeout = default) Source #
Queue this IO operation to run on the thread-pool.
Parameters
param | timeout | Maximum time that the forked IO operation can run for. |
returns | Returns a |
method K<M, ForkIO<A>> ForkIOMaybe <M, A> (this K<M, A> ma, Option<TimeSpan> timeout = default) Source #
Queue this IO operation to run on the thread-pool.
Parameters
param | timeout | Maximum time that the forked IO operation can run for. |
returns | Returns a |
Monad module
Methods
method K<M, Unit> when <M> (K<M, bool> Pred, K<IO, Unit> Then) Source #
When the predicate evaluates to true
, compute Then
Parameters
type | M | Monad |
param | Pred | Predicate |
param | Then | Computation |
returns | Unit monad |
method K<M, Unit> unless <M> (K<M, bool> Pred, K<IO, Unit> Then) Source #
When the predicate evaluates to false
, compute Then
Parameters
type | M | Monad |
param | Pred | Predicate |
param | Then | Computation |
returns | Unit monad |
method K<M, A> liftIO <M, A> (IO<A> ma) Source #
Embeds the IO
monad into the M〈A〉
monad. NOTE: This will fail if the monad transformer
stack doesn't have an IO
monad as its innermost monad.
method K<M, A> liftIO <M, A> (K<IO, A> ma) Source #
Embeds the IO
monad into the M〈A〉
monad. NOTE: This will fail if the monad transformer
stack doesn't have an IO
monad as its innermost monad.
method K<M, EnvIO> envIO <M> () Source #
Get the environment value threaded through the IO computation
Parameters
type | M | Trait |
returns | Lifted environment value |
method K<M, CancellationToken> token <M> () Source #
Get the cancellation token threaded through the IO computation
Parameters
type | M | Trait |
returns | Lifted cancellation token |
method K<M, CancellationTokenSource> tokenSource <M> () Source #
Get the cancellation token-source threaded through the IO computation
Parameters
type | M | Trait |
returns | Lifted cancellation token-source |
method K<M, Option<SynchronizationContext>> syncContext <M> () Source #
Get the synchronisation-context threaded through the IO computation
Parameters
type | M | Trait |
returns | Lifted synchronisation-context |
interface MonadIO <M> Source #
Monad that is either the IO monad or a transformer with the IO monad in its stack
Parameters
type | M | Self-referring trait |
Properties
property K<M, CancellationTokenSource> TokenSource Source #
property K<M, Option<SynchronizationContext>> SyncContext Source #
Methods
method K<M, A> LiftIO <A> (K<IO, A> ma) Source #
Lifts the IO monad into a monad transformer stack.
Parameters
type | A | Bound value type |
param | ma | IO computation to lift |
returns | The outer monad with the IO monad lifted into it |
method K<M, A> LiftIO <A> (IO<A> ma) Source #
Lifts the IO monad into a monad transformer stack.
IMPLEMENTATION REQUIRED: If this method isn't overloaded in this monad or any monad in the stack on the way to the inner-monad, then it will throw an exception.
This isn't ideal, it appears to be the only way to achieve this kind of functionality in C# without resorting to magic.
Parameters
type | A | Bound value type |
param | ma | IO computation to lift |
returns | The outer monad with the IO monad lifted into it |
method K<M, C> SelectMany <A, B, C> (K<M, A> ma, Func<A, IO<B>> bind, Func<A, B, C> project) Source #
method K<M, C> SelectMany <A, B, C> (IO<A> ma, Func<A, K<M, B>> bind, Func<A, B, C> project) Source #