Big sum up of everything:<br><br>If TestN is a newtype constructor, then<br>'<span style="font-family:courier new,monospace">TestN undefined</span>' and '<span style="font-family:courier new,monospace">undefined</span>' are exactly the same thing.<br>
<br><br><div class="gmail_quote">2012/1/22 Yitzchak Gale <span dir="ltr"><<a href="mailto:gale@sefer.org">gale@sefer.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Yves Parès wrote:<br>
>> Is there some litterature expliciting in a less empiric way than I did the<br>
>> differences like this between data and newtype? I've never come against<br>
>> such documentation through all my learning of Haskell, yet I think it's an<br>
>> important point.<br>
<br>
</div><div class="im">Roman Cheplyaka wrote:<br>
> See the Haskell report, section <a href="tel:3.17.2" value="+333172">3.17.2</a> "Informal Semantics of Pattern<br>
> Matching" [1].<br>
<br>
</div>And section 4.2.3 of the report [2] addresses exactly your points very<br>
explicitly:<br>
<br>
"A type created by newtype differs from an algebraic datatype in that...<br>
The following examples clarify the differences between data<br>
(algebraic datatypes), type (type synonyms), and newtype<br>
(renaming types)..."<br>
<br>
Regards,<br>
Yitz<br>
<br>
[1] <a href="http://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-600003.17.2" target="_blank">http://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-600003.17.2</a><br>
[2] <a href="http://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-740004.2.3" target="_blank">http://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-740004.2.3</a><br>
</blockquote></div><br>