[Haskell-cafe] Order of evaluation

C.M.Brown cmb21 at kent.ac.uk
Thu Jul 26 12:03:31 EDT 2007


Hi Jon,

On Thu, 26 Jul 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, I believe it is defined thus:

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

Therefore it is strict in its first argument (it needs to evaluate its
first argument in order to know which pattern match to take).

Chris.

>


More information about the Haskell-Cafe mailing list