functype-io
Lazy, composable IO effect type for Rust.
Part of the functype library.
IO<A>
A deferred computation that produces a value of type A or fails with an error. Nothing executes until .run() is called.
use IO;
let io = IOeffect.map;
// Nothing printed yet
let result = io.run.unwrap; // prints "side effect!", returns 84
Features
- Constructors —
succeed,fail,effect,effect_result,from_result,from_option,from_either - Combinators —
map,flat_map,zip,zip_with,then,tap - Error handling —
map_error,catch,or_else,either(),retry - Resource safety —
bracket(acquire/use/release),ensuring(finalizer) - Async interop —
from_future,to_future - Do-notation — Works with
fdo!macro viaand_then/map
Usage
[]
= "0.1"
use IO;
use fdo;
let result = fdo! ;
assert_eq!;
License
MIT OR Apache-2.0