Right now, Coercible
/~>
/.coerce
only works for wrapping and unwrapping newtypes.
For it to be really useful (like, deserving-of-its-syntax useful), it should also allow coercing e.g. Seq[Int]
to Seq[NewtypeForInt]
.
This will require a bunch of changes; we'll need to put ~>
instances into the IR and have coerce
there. We'll also need to perform the actual analysis to determine what roles a type's tyargs should have; this is a "traverse all the types in SCC order" check, though we already have the plumbing for that.
This is at least designed in. https://git.sr.ht/~remexre/sylvan/tree/1df99f1ac3c2089e3b6315334cd7a0d0e5148c8e/item/src/std/intrinsics/mod.syl#L153