On Mon, Jan 14, 2013 at 7:09 PM, Simon Peyton-Jones <span dir="ltr"><<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>></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:"Verdana","sans-serif"">Friends<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana","sans-serif"">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:"Verdana","sans-serif""> <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:"Verdana","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana","sans-serif"">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 "newtype X = X Y" coercing "Set X" to "Set Y" 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>