From mblazevic at stilo.com Wed Dec 18 13:47:37 2019 From: mblazevic at stilo.com (=?UTF-8?Q?Mario_Bla=c5=beevi=c4=87?=) Date: Wed, 18 Dec 2019 08:47:37 -0500 Subject: [Haskell-cafe] Haskell 2010 report nit? In-Reply-To: References: Message-ID: <90511d0b-8652-dc25-22c2-428e3c7e0913@stilo.com> On 2019-12-16 1:42 a.m., Viktor Dukhovni wrote: > > Not sure where to post about this, and it has likely been noted > elsewhere already, but reading through the report I see in Section > 3.17.2 I'm not sure either, but one place you could report it is at https://github.com/haskell/rfcs/issues No guarantees, but it would make the issue slightly less likely to be forgotten. > >> • Consider the following declarations: >> >> newtype N = N Bool >> data D = D !Bool >> >> These examples illustrate the difference in pattern matching between types defined by data and newtype: >> >> (\ (N True) -> True) ⊥ ⇒ ⊥ >> (\ (D True) -> True) ⊥ ⇒ ⊥ >> (\ ~(D True) -> True) ⊥ ⇒ True >> >> Additional examples may be found in Section 4.2.3. > > But unlike the examples in 4.2.3, which do show differences > between "newtype" and "data", the above does not seem to > show any actual difference. For that the pattern after the > constructor would I believe have to be irrefutable, which > "True" is not. > > Thus, e.g. the below (which duplicates 4.2.3) would do the job: > > (\ (N _) -> True) ⊥ ⇒ True > (\ (D _) -> True) ⊥ ⇒ ⊥ > > Perhaps I misunderstood something, but if not, and this has > not been noted before, it may be worth fixing in the next > revision. >