[Haskell-cafe] Re: Unwrapping newtypes
James Andrew Cook
mokus at deepbondi.net
Wed Sep 8 08:30:06 EDT 2010
On Sep 8, 2010, at 8:19 AM, Kevin Jardine wrote:
> Hi Tony,
>
> I stared at that specific section for at least half an hour earlier
> today but could not figure out how it applied in my specific case. The
> only examples I have see are for deriving Num. Do you have any more
> detail on how I could use that extension?
>
> Kevin
>
> On Sep 8, 2:05 pm, Tony Morris <tonymor... at gmail.com> wrote:
>> I think you might want -XGeneralizedNewtypeDeriving
>>
>> http://haskell.org/ghc/docs/6.12.2/html/users_guide/deriving.html#id6...
>>
>> On 08/09/10 22:01, Kevin Jardine wrote:
>>
I'm not sure if it's what he originally had in mind, but if your Obj class has a ToObj instance (which would be reasonable), then that extension allows your other classes to derive it:
> newtype Foo = Foo Obj deriving ToObj
-- James
More information about the Haskell-Cafe
mailing list