import { optic } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { _unsafeCast } = optic;
Given a Viewer<U, S, A> and an optic tag V, this function produces a view function that can be used in a Viewer<V, S, A>. However, not all casts are valid. The following are the only supported casts, by their optic tag:
- LensTag => LensTag
- LensTag => AffineTag
- LensTag => FoldTag
- AffineTag => AffineTag
- AffineTag => FoldTag
- FoldTag => FoldTag
The following are unsupported casts which will throw at runtime:
- AffineTag => LensTag
- FoldTag => AffineTag
- FoldTag => LensTag
This library has no code that leads to unsupported casts, but if one wishes to extend its functionality by replicating the cast logic, these cases must be considered.