p1eXu5.FSharp.Ports.PortTaskResult 1.0.12

There is a newer version of this package available.
See the version list below for details.
dotnet add package p1eXu5.FSharp.Ports.PortTaskResult --version 1.0.12                
NuGet\Install-Package p1eXu5.FSharp.Ports.PortTaskResult -Version 1.0.12                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="p1eXu5.FSharp.Ports.PortTaskResult" Version="1.0.12" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add p1eXu5.FSharp.Ports.PortTaskResult --version 1.0.12                
#r "nuget: p1eXu5.FSharp.Ports.PortTaskResult, 1.0.12"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install p1eXu5.FSharp.Ports.PortTaskResult as a Cake Addin
#addin nuget:?package=p1eXu5.FSharp.Ports.PortTaskResult&version=1.0.12

// Install p1eXu5.FSharp.Ports.PortTaskResult as a Cake Tool
#tool nuget:?package=p1eXu5.FSharp.Ports.PortTaskResult&version=1.0.12                

<link href="css/splendor.css" rel="stylesheet"></link>

p1eXu5.FSharp.Ports & p1eXu5.FSharp.Ports.PortTaskResult

Package Versions
p1eXu5.FSharp.Ports NuGet
p1eXu5.FSharp.Ports.PortTaskResult NuGet

Computation expressions implementing Reader (also called the Environment monad) monade.

Examples

Are located in p1eXu5.FSharp.Ports.Examples

open p1eXu5.FSharp.Ports.PortTaskBuilderCE
open p1eXu5.FSharp.Ports.PortTaskResultBuilderCE

open Microsoft.Extensions.Logging
open p1eXu5.FSharp.Ports


let logger = LoggerFactory.Create(fun builder -> builder.AddConsole() |> ignore).CreateLogger("Program")


// ========================
// Deps as anonymous record
// ========================

let deps = {| Logger = logger |}

// ------------------------
// PortTask
// ------------------------

let inline loggerPortTask<'T when 'T : (member Logger: ILogger)> =
    portTask {
        return! 
            PortTask.ask
            |> PortTask.map (fun deps -> (^T : (member Logger: ILogger) deps))
    }

let logInPortTask =
    portTask {
        let! logger = loggerPortTask
        do logger.LogInformation("In logInPortTask")
    }

do
    logInPortTask
    |> PortTask.runSynchronously deps


// ------------------------
// PortTaskResult
// ------------------------

let loggerPortTaskResult =
    loggerPortTask |> PortTaskResult.fromPortTask

// need to specify error type
let logInPortTaskResult : PortTaskResult<_, _, string> =
    portTaskResult {
        let! logger = loggerPortTaskResult
        do logger.LogInformation("In logInPortTaskResult")
    }

do
    logInPortTaskResult
    |> PortTaskResult.runSynchronously deps
    |> Result.iter (fun _ -> ())

p1eXu5.FSharp.Ports

Port

type Port<'env, 'a> = Port of action: ('env -> 'a)

// CE
open p1eXu5.FSharp.Ports.PortBuilderCE

let foo =
    port {
        ...
    }
Port module:
Function or value Signature
run env port
ask
map f port
bind f port
retn v
withEnv f port ('a → 'b) → Port<'b,'c> → Port<'a,'c>

PortResult

type PortResult<'env, 'Ok, 'Error> = Port<'env, Result<'Ok, 'Error>>

// CE
open p1eXu5.FSharp.Ports.PortBuilderCE

let foo =
    portResult {
        ...
    }
PortResult module:
Function or value Signature
run env port
ask
map f port
mapError f port
bind f port
retn v
withEnv f port ('a → 'b) → Port<'b,'c> → Port<'a,'c>
fromResult res

PortTask

type PortTask<'env, 'a> = Port<'env, Task<'a>>

// CE
open p1eXu5.FSharp.Ports.PortTaskBuilderCE

let foo =
    portTask {
        ...
    }
PortTask module:
Function or value Signature
run env portTask
retn v
ask
map f portTask
bindT taskf portTask
bind portTaskf portTask
withEnv f portTask
tee f portTask
apply mf portTask
fromTaskT t Task<'a> → PortTask<'b,'a>
fromTask t Task → PortTask<'a,unit>
fromTaskF f ('a → Task<'b>) → PortTask<'a0,('a → Task<'b>)>
applyTask portTask portTaskf PortTask<'cfg,'a> → PortTask<'cfg,('a → Task<'b>)> → PortTask<'cfg,'b>
fromValueTaskT t
fromValueTask t
applyValueTask portTask portTaskF

PortTaskResult

type PortTaskResult<'env, 'Ok, 'Error> = Port<'env, Task<Result<'Ok, 'Error>>>

// CE
open p1eXu5.FSharp.Ports.PortTaskResultBuilderCE

let foo =
    portTaskResult {
        ...
    }
PortTaskResult module:
Function or value Signature
run env portTaskResult
runSynchronously env portTaskResult
retn v
ask
map f portTaskResult
bind f portTaskResult
withEnv f portTaskResult
fromPort port
fromPortResult port
fromPortTask portTask
fromPortF f ('a → Port<'envA,'b>) → PortTaskResult<'envB,('a → Port<'envA,'b>),'Error>
applyPort portTaskResult mf
fromResult res
fromTaskResult taskRes
fromTaskT
fromTaskT t
fromTask t
fromValueTaskResult vtRes
fromValueTaskT valueTask
fromValueTask valueTask
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.15 161 2/20/2024
1.0.14 182 1/7/2024
1.0.12 201 12/5/2023
1.0.11-preview 170 10/28/2023
1.0.10-preview 115 10/7/2023
1.0.8-preview 136 10/1/2023
1.0.7-preview 148 8/5/2023
1.0.6-preview 154 6/17/2023
1.0.5-preview 144 6/7/2023
1.0.4-preview 135 6/6/2023