Orsak
eff {
let! line = Console.readLine ()
do! Console.writeLine $"Hello {line}"
}
Orsak is a library for functional effects in F#, allowing pragmatic and composable modelling of side-effects through interfaces. It is inspired by Zio, with F# encoding similar to the approach described by Bartosz Sypytkowski here.
However, Orsak is not intended to be a framework. Rather, it is encouraged and recommended to make use of the existing .NET ecosystem, and Orsak is intended to make that as easy and friction-free as possible. It can be used piecemeal, and introduced to existing codebases in isolated chunks.
This implementation makes use of resumable code to implement the computation expression builder for the lowest possible overhead.
The builder also has various overloads for Bind, allowing for friction free interop with TaskLike<'a>, Async<'a>, Result<'T,'E> and more.
It supports for, while, use, try-with and try-finally, and also applicative bind when the error-type supports +.
While the computation expression is the intended way of working with effects, the corresponding module should contain all the expected functions.
Where to go next:
- Introduction and Composition: creating effects from interfaces, and why they compose.
- Errors: modelling errors as unions, combining and handling them, and where exceptions fit in.
- Resilience: retrying, backing off, timing out and keeping background work alive.
- Effect sequences: streaming results, such as pages from an API, as effects.
- Web APIs: running effects in web APIs, with minimal APIs, Giraffe, Oxpecker and Orsak.AspNetCore.
- OpenAPI: describing the endpoints of Orsak.AspNetCore in OpenAPI documents, with Orsak.AspNetCore.OpenApi.
- Testing: running effects with environments of fakes, including the clock.
- Scopes: running effects in transactions and other scopes, with an environment that grows.
- Generating code: generating effects and environments from interfaces with Orsak.Myriad.
- Fable: effects in F# compiled to JavaScript, with what differs from .NET, and what is .NET only.
- Remoting: calling the members of an interface on a server, from Fable or .NET, with Orsak.Remoting.
- Supported frameworks: the .NET versions each package targets, and how that changes.
- The API reference.
Orsak