Newtype wrappers

Johan Tibell johan.tibell at gmail.com
Mon Jan 14 20:42:00 CET 2013


On Mon, Jan 14, 2013 at 11:14 AM, Andrea Vezzosi <sanzhiyan at gmail.com> wrote:
> 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.

I was just going to say that. Changing newtypes changes instances,
which isn't safe in the general case.

-- Johan



More information about the Glasgow-haskell-users mailing list