[Haskell-cafe] newtype is superfluous

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Sat Oct 15 09:07:21 EDT 2005


Wolfgang Jeltsch wrote:
> This is not true.  With newtype, A _|_ is _|_, with data, A _|_ is not _|_.

It's probably more helpful to explain this in terms of a program that 
exhibits different behavior in the two cases:

   case error "data" of A x -> "newtype"

> But as far as I know, the above newtype declaration is equivalent to this:
> 
> 	data A = A !Int

Nope:

   case A (error "data!") of A x -> "data or newtype"

-- Ben


More information about the Haskell-Cafe mailing list