[Haskell-cafe] Implicit newtype unwrapping

Gregory Crosswhite gcross at phys.washington.edu
Wed Dec 2 20:32:09 EST 2009


Ah, that's a really good point.  It seems then that there is a use for implicitly unwrapped newtypes, but perhaps only when you never really wanted to use a newtype to begin with but had to in order to use a different instance declaration for the same type.  That suggests that the feature we'd really like is a way to declare that we want a type in a context to act as if it had a different instance declaration for a given typeclass, without having to go through newtype.

Cheers,
Greg

On Dec 2, 2009, at 5:08 PM, Greg Fitzgerald wrote:

> Gregory Crosswhite <gcross at phys.washington.edu> wrote:
>> Out of curiosity, why would one want a "newtype" that were unwrapped implicitly, rather than just using "type"?
> 
> One reason might be because you only switched from 'type' to 'newtype'
> so that you could write more refined Arbitrary instances for your
> QuickCheck tests.
> 
> -Greg



More information about the Haskell-Cafe mailing list