FSharpPlus


Compose

Allows to compose applicatives and functors.

It worth noting that:

Examples

#r @"nuget: FSharpPlus"
open FSharpPlus
open FSharpPlus.Data

// First let's create some values

let (one : Async<Result<int, string>>) = async { return Ok 1 }
let (two : Async<Result<int, string>>) = async { return Ok 2 }

// Now we can combine then

let (Compose three) = Compose (async {return Ok (+)}) <*> Compose one <*> Compose two
// val three : Async<FSharpPlus.Result<int,string>>

// or shorter

let (Compose three') = (+) <!> Compose one <*> Compose two
// val three' : Async<FSharpPlus.Result<int,string>>
namespace FSharpPlus
namespace FSharpPlus.Data
val one: Async<Result<int,string>>
Multiple items
module Async from FSharpPlus
<summary> Additional operations on Async </summary>

--------------------
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<'T> -> Async<'T> + 1 overload 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 Choice: computations: seq<Async<'T option>> -> Async<'T option> static member FromBeginEnd: beginAction: (AsyncCallback * obj -> IAsyncResult) * endAction: (IAsyncResult -> 'T) * ?cancelAction: (unit -> unit) -> Async<'T> + 3 overloads static member FromContinuations: callback: (('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> ...
<summary>Holds static members for creating and manipulating asynchronous computations.</summary>
<remarks> See also <a href="https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/asynchronous-workflows">F# Language Guide - Async Workflows</a>. </remarks>
<category index="1">Async Programming</category>


--------------------
type Async<'T>
<summary> An asynchronous computation, which, when run, will eventually produce a value of type T, or else raises an exception. </summary>
<remarks> This type has no members. Asynchronous computations are normally specified either by using an async expression or the static methods in the <see cref="T:Microsoft.FSharp.Control.FSharpAsync`1" /> type. See also <a href="https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/asynchronous-workflows">F# Language Guide - Async Workflows</a>. </remarks>
<namespacedoc><summary> Library functionality for asynchronous programming, events and agents. See also <a href="https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/asynchronous-workflows">Asynchronous Programming</a>, <a href="https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/members/events">Events</a> and <a href="https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/lazy-expressions">Lazy Expressions</a> in the F# Language Guide. </summary></namespacedoc>
<category index="1">Async Programming</category>
Multiple items
module Result from FSharpPlus.Data
<summary> Additional operations on Result </summary>

--------------------
module Result from FSharpPlus
<summary> Additional operations on Result&lt;'T,'Error&gt; </summary>

--------------------
module Result from Microsoft.FSharp.Core
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Core.FSharpResult`2" />.</summary>
<category>Choices and Results</category>


--------------------
[<Struct>] type Result<'T,'TError> = | Ok of ResultValue: 'T | Error of ErrorValue: 'TError
<summary>Helper type for error handling without exceptions.</summary>
<category>Choices and Results</category>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)
<summary>Converts the argument to signed 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using <c>Int32.Parse()</c> with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted int</returns>
<example id="int-example"><code lang="fsharp"></code></example>


--------------------
[<Struct>] type int = int32
<summary>An abbreviation for the CLI type <see cref="T:System.Int32" />.</summary>
<category>Basic Types</category>


--------------------
type int<'Measure> = int
<summary>The type of 32-bit signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to <see cref="T:System.Int32" />.</summary>
<category>Basic Types with Units of Measure</category>
Multiple items
val string: value: 'T -> string
<summary>Converts the argument to a string using <c>ToString</c>.</summary>
<remarks>For standard integer and floating point values the and any type that implements <c>IFormattable</c><c>ToString</c> conversion uses <c>CultureInfo.InvariantCulture</c>. </remarks>
<param name="value">The input value.</param>
<returns>The converted string.</returns>
<example id="string-example"><code lang="fsharp"></code></example>


--------------------
type string = System.String
<summary>An abbreviation for the CLI type <see cref="T:System.String" />.</summary>
<category>Basic Types</category>
val async: AsyncBuilder
<summary>Builds an asynchronous workflow using computation expression syntax.</summary>
<example id="async-1"><code lang="fsharp"> let sleepExample() = async { printfn "sleeping" do! Async.Sleep 10 printfn "waking up" return 6 } sleepExample() |&gt; Async.RunSynchronously </code></example>
union case Result.Ok: ResultValue: 'T -> Result<'T,'TError>
<summary> Represents an OK or a Successful result. The code succeeded with a value of 'T. </summary>
val two: Async<Result<int,string>>
Multiple items
union case Compose.Compose: 'functorF<'functorG<'t>> -> Compose<'functorF<'functorG<'t>>>

--------------------
module Compose from FSharpPlus.Data
<summary> Basic operations on Compose </summary>

--------------------
[<Struct>] type Compose<'functorF<'functorG<'t>>> = | Compose of 'functorF<'functorG<'t>> static member ( *> ) : x: 'FunctorF<'FunctorG<'T>> * y: 'FunctorF<'FunctorG<'U>> -> 'FunctorF<'FunctorG<'U>> (requires member Map and member ``<*>``) static member (<!>) : f: ('T -> 'U) * x: 'FunctorF<'FunctorG<'T>> -> Compose<'FunctorF<'FunctorG<'U>>> (requires member Map and member Map) static member ( <* ) : x: 'FunctorF<'FunctorG<'U>> * y: 'FunctorF<'FunctorG<'T>> -> 'FunctorF<'FunctorG<'U>> (requires member ``<*>`` and member Map) static member (<*>) : Compose<'ApplicativeF<'ApplicativeG<'T->'U>> * Compose<'ApplicativeF<'ApplicativeG<'T>> -> Compose<'ApplicativeF<'ApplicativeG<'U>> (requires member Map and member ``<*>`` and member ``<*>``) static member (<|>) : Compose<'AlternativeF<'ApplicativeG<'T>> * Compose<'AlternativeF<'ApplicativeG<'T>> -> Compose<'AlternativeF<'ApplicativeG<'T>> (requires member ``<|>``) static member Lift2: f: ('T -> 'U -> 'V) * Compose<'ApplicativeF<'ApplicativeG<'T>> * Compose<'ApplicativeF<'ApplicativeG<'U>> -> Compose<'ApplicativeF<'ApplicativeG<'V>> (requires member Lift2 and member Lift2) static member Lift3: f: ('T -> 'U -> 'V -> 'W) * Compose<'ApplicativeF<'ApplicativeG<'T>> * Compose<'ApplicativeF<'ApplicativeG<'U>> * Compose<'ApplicativeF<'ApplicativeG<'V>> -> Compose<'ApplicativeF<'ApplicativeG<'W>> (requires member Lift3 and member Lift3) static member Map: Compose<'FunctorF<'FunctorG<'T>>> * f: ('T -> 'U) -> Compose<'FunctorF<'FunctorG<'U>>> (requires member Map and member Map) static member Return: x: 'T -> Compose<'ApplicativeF<'ApplicativeG<'T>> (requires member Return and member Return) static member get_Empty: unit -> Compose<'AlternativeF<'ApplicativeG<'T>> (requires member Empty)
<summary> Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad. </summary>
val three: Async<Result<int,string>>
val three': Async<Result<int,string>>