vendredi 2 avril 2021

Evaluation of multiple conditions combined using AND in a single if statement

In languages such as C++, if there are multiple conditions in an "if" statement, and the conditions are combined with using AND (i.e., &&) then as soon as one of the conditions is false, the evaluation of the subsequent conditions do not happen. Is this also true for Haskell? For example, in the Haskell code below, of conditionA is FALSE, will the evaluation of conditionB happen?

fun :: Haxl (Maybe Bool)
fun =
 if conditionA .&& conditionB
    then return $ Just True
    else return Nothing

Aucun commentaire:

Enregistrer un commentaire