<div dir="ltr">On Tue, Mar 24, 2015 at 9:57 AM, wren romano <span dir="ltr"><<a href="mailto:winterkoninkje@gmail.com" target="_blank">winterkoninkje@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">So I was working on porting my libraries to work for GHC 7.10 and I<br>
ran into a snag. Unlike the concrete type Data.Array.Array,  the<br>
concrete type Data.Array.Unboxed.UArray is defined as being nominal in<br>
the second type argument— is this a bug?<br></blockquote><div><br></div><div>No, see <a href="https://ghc.haskell.org/trac/ghc/ticket/9220">https://ghc.haskell.org/trac/ghc/ticket/9220</a>.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If not, then why must it be nominal? Shouldn't (UArray a New) and<br>
(UArray a Old) have the same representation in memory? Using<br>
unsafeCoerce has always been safe here in the past...<br></blockquote><div><br></div><div>It wasn't and isn't necessarily safe (though in some cases it is safe). The IArray instances for Old and New could be unrelated (for example, they could use a different amount of space per element). Knowing that Old and New are related by a coercion means that the heap representation of actual values of types Old and New are the same, but that says nothing about how these values are stored in an unboxed array.<br><br></div><div>Regards,<br></div><div>Reid Barton<br></div></div></div></div>