When ones makes an ADT with data constructors that has strict (and
maybe unpacked) fields,

e.g.

data Vec2 a  = Vec2 {-# UNPACK #-} !a {-# UNPACK #-} !a

how does one define an NFData instance?

Like this?

instance NFData a => NFData (Vec2 a) where
  rnf (Vec2 x y) = rnf x `seq` rnf y

Or is it enough to just do
instance NFData a => NFData (Vec2 a)

since Vec2 is fully strict anyway, so that default rnf implementation will do?

Thanks,
Peter
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to