Newtype wrappers

Andrea Vezzosi sanzhiyan at gmail.com
Mon Jan 14 20:14:32 CET 2013


On Mon, Jan 14, 2013 at 7:09 PM, Simon Peyton-Jones
<simonpj at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20130114/dd04d755/attachment-0001.htm>


More information about the Glasgow-haskell-users mailing list