unsafeCoerce and type aliases under type applications

Felipe Almeida Lessa felipe.lessa at gmail.com
Sun Dec 4 18:40:00 CET 2011


On Sun, Dec 4, 2011 at 3:30 PM, Erik Hesselink <hesselink at gmail.com> wrote:
> It's not just type families though, right? I mean, a (Map A) cannot be
> coerced to a (Map B), even if B is a newtype over A, since they might
> have different Ord instances, and thus a different map structure.

It depends on what you call "safe".  The bug Brent Yorgey was
referring to allows you to get sefaults and the like.  The bug you're
describing violates some invariants, but these invariants are not
expressed in the type system and won't make a hard crash of your
program.

Cheers,

-- 
Felipe.



More information about the Libraries mailing list