Re: [Haskell-cafe] NFData question

2009-09-04 Thread Daniel Fischer
Am Freitag 04 September 2009 21:57:27 schrieb Peter Verswyvelen: > 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? > > instanc

Re: [Haskell-cafe] NFData question

2009-09-04 Thread Jason Dagit
On Fri, Sep 4, 2009 at 12:57 PM, Peter Verswyvelen wrote: > 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 NFDat

[Haskell-cafe] NFData question

2009-09-04 Thread Peter Verswyvelen
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 e