id_effect 0.4.0

Effect<A, E, R> (sync + async), capability DI, pipe — interpreter-style, no bundled executor
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Prisms and Optionals

A [`Prism<S, A>`](../../../../id_effect_optics/src/prism.rs) focuses a **sum-type** variant:

```rust
use id_effect_optics::Prism;

enum Shape { Circle(f64), Rect { w: f64, h: f64 } }

let circle = Prism::new(
    |s: &Shape| match s { Shape::Circle(r) => Some(*r), _ => None },
    Shape::Circle,
);
```

[`Optional`](../../../../id_effect_optics/src/optional.rs) wraps a `Lens<S, Option<T>>` for fallible inner access (`set_some`, `set_none`, `modify`).

> **Stub:** prism composition with schema tagged unions — ch20 parse codecs.