Some primitives could be rewrapped to be used as other ones based on structural subtyping relations.

However, all these castings are explicit so we do not end with hellish type errors.

These methods could help you with casting: wrap, unwrap, rewrap.

If you want to know more about how it works, checkout this article: Structural wrapper subtyping.