id_effect_fp
Functional-programming toolkit for id_effect — maintenance tier
(ADR 0010): kept building and tested, not on the core
roadmap.
These modules lived in the core id_effect crate until 0.6. The core runtime does not need them,
so they moved here together with their im and Rayon-backed bulk operations:
| Module | What | Formerly |
|---|---|---|
algebra |
Semigroup, Monoid, Functor, Applicative, Monad, Bifunctor, Contravariant, Selective, Foldable, Traversable, FreeAp |
id_effect::algebra |
collections |
Persistent EffectHashMap / EffectHashSet / EffectSortedMap / EffectSortedSet / EffectVector / RedBlackTree (backed by im), MutableList, MutableQueue, ChunkBuilder, Trie |
id_effect::collections |
stm |
TRef, TMap, TQueue, TSemaphore, Stm, commit / atomically |
id_effect::stm |
foundation |
Unit, Never, Iso, products, coproducts, function, option_ |
id_effect::foundation::* |
result, reader, thunk |
Pure Result combinators, the Reader monad, one-shot thunks |
id_effect::kernel::{result, reader, thunk} |
Either, Pipe, Predicate, MutableRef and func stay in id_effect::foundation.
Example
use run_blocking;
use ;
// STM: transactional reference cells, committed as an `Effect`.
let counter = run_blocking.expect;
run_blocking.expect;
assert_eq!;
// Persistent collections: updates return new maps; the old one is untouched.
let a = set;
let b = set;
assert_eq!;
// Algebra: combine values through type-class traits.
assert_eq!;
assert_eq!;
Examples
STM examples: 077–082; algebra examples: 090–092.