[Haskell-cafe] seq and lambda with patterns
Denis Moskvin
dmoskvin at gmail.com
Wed Sep 28 12:00:57 UTC 2016
There is some subtle, but reasonable difference between \pat1 pat2 -> expr
and \pat1 -> \pat2 -> expr:
> seq ((\True y -> "DEFINED") undefined) 42
42
> seq ((\True -> \y -> "DEFINED") undefined) 42
*** Exception: Prelude.undefined
The reason is the translation from Haskell Report 2010 (3.3)
\ p1 . . . pn -> e = \ x1 . . . xn -> case (x1 , . . . , xn ) of (p1 , . .
. , pn ) -> e
Today I found (GHC 8.0.1) that
> seq ((\True -> \y -> undefined) undefined) 42
42
Is the last result correct?
--
Denis Moskvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160928/a10ab91e/attachment.html>
More information about the Haskell-Cafe
mailing list