Effect 0.1.0-alpha.2
dotnet add package Effect --version 0.1.0-alpha.2
NuGet\Install-Package Effect -Version 0.1.0-alpha.2
<PackageReference Include="Effect" Version="0.1.0-alpha.2" />
<PackageVersion Include="Effect" Version="0.1.0-alpha.2" />
<PackageReference Include="Effect" />
paket add Effect --version 0.1.0-alpha.2
#r "nuget: Effect, 0.1.0-alpha.2"
#:package Effect@0.1.0-alpha.2
#addin nuget:?package=Effect&version=0.1.0-alpha.2&prerelease
#tool nuget:?package=Effect&version=0.1.0-alpha.2&prerelease
Effect
Typed, composable effects for F#.
An Effect<'R, 'E, 'A> is a lazy description of a program that requires an environment 'R, can fail with a typed error 'E, and produces a value 'A.
Install
dotnet add package Effect --prerelease
Quick start
open Eff
type AppError = NotFound | Unauthorized
let program =
effect {
let! x = Effect.succeed 10
let! y = Effect.succeed 20
return x + y
}
let result = program |> Effect.run () |> fun t -> t.Result
// Ok 30
Error handling
let safe =
riskyOperation ()
|> Effect.catchAll (fun err ->
match err with
| NotFound -> Effect.succeed "default"
| other -> Effect.fail other)
Environment / dependency injection
type IAppEnv =
abstract Db: IDatabase
abstract Logger: ILogger
let getUser id : Effect<IAppEnv, AppError, User> =
effect {
let! env = Effect.env<IAppEnv, AppError>
let! user = env.Db.FindById id |> Effect.fromTaskResult
return user
}
let result = getUser 1 |> Effect.run myEnv
Retry with schedules
let resilient =
fetchFromApi ()
|> EffectSchedule.retry (
Schedule.exponentialN (TimeSpan.FromMilliseconds 100.0) 3)
Cooperative cancellation
CancellationToken flows through the entire effect chain.
let cts = new CancellationTokenSource()
cts.CancelAfter(1000)
let! result = Effect.runWithCancellation myEnv cts.Token myEffect
Related packages
- Effect.DI — composable dependency injection layers
- Effect.Concurrency — fibers, streams, concurrent data structures
- Effect.Platform — HTTP, file system, console with typed errors
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- FSharp.Core (>= 10.1.201)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Effect:
| Package | Downloads |
|---|---|
|
Effect.DI
Composable dependency injection layers for Effect. Build, compose, and manage service lifetimes with typed errors and resource safety. |
|
|
Effect.Concurrency
Structured concurrency primitives for Effect. Fibers, Ref, Deferred, Queue, parallel/race combinators, timeouts, and supervision. |
|
|
Effect.Platform
Platform services for Effect. HttpClient, FileSystem, and Console with typed errors and dependency injection. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-alpha.2 | 88 | 4/6/2026 |
| 0.1.0-alpha.1 | 72 | 4/6/2026 |