Big sum up of everything:
If TestN is a newtype constructor, then
'TestN undefined' and 'undefined' are exactly the same thing.
Yves Parès wrote:
>> Is there some litterature expliciting in a less empiric way than I did the
>> differences like this between data and newtype? I've never come against
>> such documentation through all my learning of Haskell, yet I think it's an
>> important point.
Roman Cheplyaka wrote:And section 4.2.3 of the report [2] addresses exactly your points very
> See the Haskell report, section 3.17.2 "Informal Semantics of Pattern
> Matching" [1].
explicitly:
"A type created by newtype differs from an algebraic datatype in that...
The following examples clarify the differences between data
(algebraic datatypes), type (type synonyms), and newtype
(renaming types)..."
Regards,
Yitz
[1] http://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-600003.17.2
[2] http://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-740004.2.3