[Haskell-cafe] Re: Unwrapping newtypes
Tony Morris
tonymorris at gmail.com
Wed Sep 8 08:24:01 EDT 2010
On 08/09/10 22:19, 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?
>
>
Here is an example:
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
class C a where
c :: a -> Int
data G = G
instance C G where
c _ = 7
newtype H = H G deriving C
--
Tony Morris
http://tmorris.net/
More information about the Haskell-Cafe
mailing list