Hi Andres,

2012/2/24 Andres Löh <andres.loeh@googlemail.com>
I don't understand what's going on here. Instances for V1 should of
course be defined if they can be! And in this case, a V1 instance
makes sense and should be defined. The definition itself doesn't
matter, as it'll never be executed.

The definition certainly matters:

data Ze deriving Generic

class DeepSeq a where
  rnf :: a -> ()
  default rnf :: (Generic a, GDeepSeq (Rep a)) => a -> ()
  rnf = grnf . from

instance DeepSeq Ze

class GDeepSeq f where
  grnf :: f a -> ()

instance GDeepSeq V1 where
  grnf _ = ()

instance GDeepSeq a => GDeepSeq (M1 i c a) where
  grnf = grnf . unM1

-- other instances are not relevant now

t :: Ze
t = undefined

seq t () == undefined. rnf t == (), because the V1 instance dictates so.


Cheers,
Pedro