[Haskell-cafe] Order of evaluation
Jonathan Cast
jcast at ou.edu
Thu Jul 26 12:01:43 EDT 2007
On Thursday 26 July 2007, Jon Harrop wrote:
> If you have a boolean-or expression:
>
> a || b
>
> will "a" be evaluated before "b" in Haskell as it is in other languages?
Yes.
The definition of (||) is roughly
True || b = True
False || b = b
Which de-sugars to
(||) = \ a b -> case a of
True -> True
False -> b
Which does exactly what you want.
Jonathan Cast
http://sourceforge.net/projects/fid-core
http://sourceforge.net/projects/fid-emacs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070726/af908092/attachment.bin
More information about the Haskell-Cafe
mailing list