On Thu, Oct 11, 2007 at 02:32:25PM -0700, Dan Weston wrote: > I presume that the two statements below are equivalent [1]: > > newtype A = MkA Int > data A = MkA !Int > > So does Haskell' still need newtype? It seems like a needless keyword.
they are not the same: > newtype A = MkA Int > data B = MkB !Int f (MkA x) = 3 g (MkB x) = 3 f _|_ = 3 g _|_ = _|_ newtype construction/deconstruction is defined to be a nop, data deconstruction always requires evaluation. just because the value inside the data type is guarenteed not to be bottom, it doesn't mean deconstruction/construction is a nop. That said, ghc is quite clever and figured out it can unbox that data type for you in this particular case, but such a transformation is not necessarily valid in general. John -- John Meacham - ⑆repetae.net⑆john⑈ _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime