LanguageExt.Core

LanguageExt.Core Traits Monads MonadIO

Contents

class MonadIOExtensions Source #

Monad that is either the IO monad or a transformer with the IO monad in its stack

Parameters

type M

Self referring trait

Methods

method K<M, IO<A>> ToIO <M, A> (this K<M, A> ma) Source #

where M : MonadIO<M>, Monad<M>

Convert an action in mato an action in IO.

method K<M, B> MapIO <M, A, B> (this K<M, A> ma, Func<IO<A>, IO<B>> f) Source #

where M : MonadIO<M>, Monad<M>

Convert an action in mato an action in IO.

method K<M, B> MapIO <M, A, B> (this Func<IO<A>, IO<B>> f, K<M, A> ma) Source #

where M : MonadIO<M>, Monad<M>

Map the underlying IO monad

class MonadIO Source #

Monad module

Methods

method K<M, A> liftIO <M, A> (IO<A> ma) Source #

where M : Monad<M>

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 #

where M : Monad<M>

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, IO<A>> toIO <M, A> (K<M, A> ma) Source #

where M : Monad<M>

Get the IO monad from within the M monad

This only works if the M trait implements MonadIO.ToIO.

method K<M, B> mapIO <M, A, B> (Func<IO<A>, IO<B>> f, K<M, A> ma) Source #

where M : MonadIO<M>, Monad<M>

Map the underlying IO monad

interface MonadIO <M> Source #

where M : MonadIO<M>, Monad<M>

Monad that is either the IO monad or a transformer with the IO monad in its stack

Parameters

type M

Self referring trait

Methods

method K<M, A> LiftIO <A> (K<IO, A> ma) Source #

Lifts the IO monad into a monad transformer stack.

If this method isn't overloaded in the inner monad or any monad in the stack on the way to the inner monad then it will throw an exception.

This isn't ideal - however 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, A> LiftIO <A> (IO<A> ma) Source #

Lifts the IO monad into a monad transformer stack.

If this method isn't overloaded in the inner monad or any monad in the stack on the way to the inner monad then it will throw an exception.

This isn't ideal - however 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, IO<A>> ToIO <A> (K<M, A> ma) Source #

Extract the IO monad from within the M monad (usually as part of a monad-transformer stack).

method K<M, B> MapIO <A, B> (K<M, A> ma, Func<IO<A>, IO<B>> f) Source #

Extract the IO monad from within the M monad (usually as part of a monad-transformer stack). Then perform a mapping operation on the IO action before lifting the IO back into the M monad.