
4 Dec
2011
4 Dec
'11
12:50 a.m.
On 12/3/11 9:07 PM, Felipe Almeida Lessa wrote:
On Sat, Dec 3, 2011 at 5:39 PM, Joachim Breitner
wrote: have used unsafeCoerce to change the type inside a container to a "type" alias in real code, but your post makes me wonder: Under what circumstances is that safe? Is that documented somehow? Can a tool or the compiler decide for us whether it is safe?
AFAIK, newtypes are safe, and for everything else you're on your own. =)
N.B., newtypes are safe in the sense of congruent rewriting; i.e., if X is a newtype of Y, then we can rewrite X to Y (or Y to X) in any subterm of the type term (just like if X = Y or X ~ Y). It's not just at the top-level of the type term. -- Live well, ~wren