Constructors for Unfold — build-only multi-focus optic, backed by Forget[F] (Forget[F][X, B] = F[B]) with S = A = Unit ruling out the read path; .embed is the consumption surface.
Construct from a recursion-scheme algebra over a pattern functor — F need not (and usually cannot) be Applicative, so the vestigial to has no canonical value and THROWS if a read-side operation forces it. The build-only surface (.embed, the fused andThens, the build side of composition) never does.
Construct from a recursion-scheme algebra over a pattern functor — F need not (and usually cannot) be Applicative, so the vestigial to has no canonical value and THROWS if a read-side operation forces it. The build-only surface (.embed, the fused andThens, the build side of composition) never does.
Attributes
Example
enum BinF[+A]:
case LeafF(n: Int); case BranchF(l: A, r: A)
val eval = Unfold.algebra[Int, Int, BinF] {
case BinF.LeafF(n) => n
case BinF.BranchF(l, r) => l + r
}