[Haskell-cafe] Spot the difference!

Nils Anders Danielsson nad at cs.chalmers.se
Thu Sep 20 07:47:16 EDT 2007


On Thu, 20 Sep 2007, PR Stanley <prstanley at ntlworld.com> wrote:

> \_ n -> 1 + n
> \_ -> (\n -> 1 + n)
> The outcome seems to be identical. is there a substantive difference
> between the two definitions?

No, since you do not pattern match on the first argument. Otherwise,
due to the way these definitions are translated into the core fragment
of Haskell in the report, and the presence of seq, the two definitions
can have observably different semantics. See "Chasing Bottoms: A Case
Study in Program Verification in the Presence of Partial and Infinite
Values", page 4.

  http://www.cs.chalmers.se/~nad/publications/danielsson-jansson-mpc2004.html

-- 
/NAD


More information about the Haskell-Cafe mailing list