Prisms and Optionals

A Prism<S, A> focuses a sum-type variant:

#![allow(unused)]
fn main() {
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 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.