On Mon, Jan 14, 2013 at 7:09 PM, Simon Peyton-Jones <span dir="ltr">&lt;<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div lang="EN-GB" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;">Friends<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;">I’d like to propose a way to “promote” newtypes over their enclosing type.  Here’s the writeup<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;">          <a href="http://hackage.haskell.org/trac/ghc/wiki/NewtypeWrappers" target="_blank">
http://hackage.haskell.org/trac/ghc/wiki/NewtypeWrappers</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;">Any comments?  Below is the problem statement, taken from the above page.</span></p></div></div></blockquote><div><br></div><div>Have you considered the effect on types like Data.Set that use the uniqueness of typeclass instances to maintain invariants? e.g. even when we have &quot;newtype X = X Y&quot; coercing &quot;Set X&quot; to &quot;Set Y&quot; can produce a tree with the wrong shape for the Ord instance of Y.</div>
<div><br></div><div><br></div><div><br></div><div>-- Andrea</div></div>