Orsak


WrapOnce Module

Type extensions

Type extension Description

Effect.Create(f)

Full Usage: Effect.Create(f)

Parameters:
    f : 'a -> Async<'b> - The effect creation function

Returns: Effect<'a, 'b, 'c>

Creates an effect from a function.

Extended Type: Effect

f : 'a -> Async<'b>

The effect creation function

Returns: Effect<'a, 'b, 'c>

Effect.Create(f)

Full Usage: Effect.Create(f)

Parameters:
    f : 'a -> Result<'b, 'e> - The effect creation function

Returns: Effect<'a, 'b, 'e>

Creates an effect from a function returning Result.

Extended Type: Effect

f : 'a -> Result<'b, 'e>

The effect creation function

Returns: Effect<'a, 'b, 'e>

Effect.Create(f)

Full Usage: Effect.Create(f)

Parameters:
    f : 'a -> Task<'b> - The effect creation function

Returns: Effect<'a, 'b, 'c>

Creates an effect from a function.

Extended Type: Effect

f : 'a -> Task<'b>

The effect creation function

Returns: Effect<'a, 'b, 'c>
Example

To create reusable effects from Interfaces used to describe the effects, use the following pattern.

 open Orsak
 open System.Threading.Tasks
 type MyEffect = abstract member DoEffect: int -> Task<string>
 type MyEffectProvider = abstract member Effect: MyEffect
 module MyEffect =
     let doEffect x =
         Orsak.Effect.Create(fun (e: #MyEffectProvider) -> e.Effect.DoEffect(x))
namespace System
namespace System.Threading
namespace System.Threading.Tasks
type MyEffect = abstract DoEffect: int -> Task<string>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Multiple items
type Task = interface IAsyncResult interface IDisposable new: action: Action -> unit + 7 overloads member ConfigureAwait: continueOnCapturedContext: bool -> ConfiguredTaskAwaitable member ContinueWith: continuationAction: Action<Task,obj> * state: obj -> Task + 19 overloads member Dispose: unit -> unit member GetAwaiter: unit -> TaskAwaiter member RunSynchronously: unit -> unit + 1 overload member Start: unit -> unit + 1 overload member Wait: unit -> unit + 5 overloads ...
<summary>Represents an asynchronous operation.</summary>

--------------------
type Task<'TResult> = inherit Task new: ``function`` : Func<obj,'TResult> * state: obj -> unit + 7 overloads member ConfigureAwait: continueOnCapturedContext: bool -> ConfiguredTaskAwaitable<'TResult> member ContinueWith: continuationAction: Action<Task<'TResult>,obj> * state: obj -> Task + 19 overloads member GetAwaiter: unit -> TaskAwaiter<'TResult> member WaitAsync: cancellationToken: CancellationToken -> Task<'TResult> + 2 overloads member Result: 'TResult static member Factory: TaskFactory<'TResult>
<summary>Represents an asynchronous operation that can return a value.</summary>
<typeparam name="TResult">The type of the result produced by this <see cref="T:System.Threading.Tasks.Task`1" />.</typeparam>


--------------------
Task(action: System.Action) : Task
Task(action: System.Action, cancellationToken: System.Threading.CancellationToken) : Task
Task(action: System.Action, creationOptions: TaskCreationOptions) : Task
Task(action: System.Action<obj>, state: obj) : Task
Task(action: System.Action, cancellationToken: System.Threading.CancellationToken, creationOptions: TaskCreationOptions) : Task
Task(action: System.Action<obj>, state: obj, cancellationToken: System.Threading.CancellationToken) : Task
Task(action: System.Action<obj>, state: obj, creationOptions: TaskCreationOptions) : Task
Task(action: System.Action<obj>, state: obj, cancellationToken: System.Threading.CancellationToken, creationOptions: TaskCreationOptions) : Task

--------------------
Task(``function`` : System.Func<'TResult>) : Task<'TResult>
Task(``function`` : System.Func<obj,'TResult>, state: obj) : Task<'TResult>
Task(``function`` : System.Func<'TResult>, cancellationToken: System.Threading.CancellationToken) : Task<'TResult>
Task(``function`` : System.Func<'TResult>, creationOptions: TaskCreationOptions) : Task<'TResult>
Task(``function`` : System.Func<obj,'TResult>, state: obj, cancellationToken: System.Threading.CancellationToken) : Task<'TResult>
Task(``function`` : System.Func<obj,'TResult>, state: obj, creationOptions: TaskCreationOptions) : Task<'TResult>
Task(``function`` : System.Func<'TResult>, cancellationToken: System.Threading.CancellationToken, creationOptions: TaskCreationOptions) : Task<'TResult>
Task(``function`` : System.Func<obj,'TResult>, state: obj, cancellationToken: System.Threading.CancellationToken, creationOptions: TaskCreationOptions) : Task<'TResult>
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
type MyEffectProvider = abstract Effect: MyEffect
val doEffect: x: 'a -> 'b
val x: 'a

Effect.Create(f)

Full Usage: Effect.Create(f)

Parameters:
    f : 'a -> ValueTask<'b> - The effect creation function

Returns: Effect<'a, 'b, 'c>

Creates an effect from a function.

Extended Type: Effect

f : 'a -> ValueTask<'b>

The effect creation function

Returns: Effect<'a, 'b, 'c>