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: Async<'T option> seq -> 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> ...

--------------------
type Async<'T>
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

--------------------
[<Struct>] type Result<'T,'TError> = | Ok of ResultValue: 'T | Error of ErrorValue: 'TError
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

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

--------------------
type int<'Measure> = int
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
val async: AsyncBuilder
union case Result.Ok: ResultValue: 'T -> Result<'T,'TError>
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<'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 Map2: f: ('T -> 'U -> 'V) * Compose<'ApplicativeF<'ApplicativeG<'T>> * Compose<'ApplicativeF<'ApplicativeG<'U>> -> Compose<'ApplicativeF<'ApplicativeG<'V>> (requires member Map2 and member Map2) ...
<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>>