On Mon, Jan 14, 2013 at 7:09 PM, Simon Peyton-Jones <simonpj@microsoft.com> wrote:

Friends

 

I’d like to propose a way to “promote” newtypes over their enclosing type.  Here’s the writeup

          http://hackage.haskell.org/trac/ghc/wiki/NewtypeWrappers

 

Any comments?  Below is the problem statement, taken from the above page.


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.



-- Andrea