[Haskell-cafe] Re: Order of evaluation

apfelmus apfelmus at quantentunnel.de
Thu Jul 26 12:18:52 EDT 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, although the meaning of the phrase "evaluated before" is a bit
tricky in a lazy language, so it's probably better to state it with
denotational semantics alone:

   _|_  ||  b  = _|_

Maybe you also want to know whether the second argument "is evaluated".
This is answered by

  True  || _|_ = True
  False || _|_ = _|_


Regards,
apfelmus



More information about the Haskell-Cafe mailing list