if first.isJust then first else second c && (!a || !b) == c && !(a && b)
false (all lower case) are the values of type
if expressions have the following form:
if <Expr::Boolean> then <Expr::a> else <Expr::a>
The condition must be of type
Boolean. There is no implicit conversion to
Boolean from, for example,
Integer. The types of the
else branches must be the same.
if must have an
else branch, there is no
else branch will extend as far as possible.
Example: To clarify by what “as far as possible” means, the following code:
if condition then foo else bar ++ if condition2 then foo2 else bar2 ++ morewill parse as
if (condition) then (foo) else (bar ++ if (condition2) then (foo2) else (bar2 ++ more))
The standard C-style boolean operators are present:
<Expr::Boolean> && <Expr::Boolean> <Expr::Boolean> || <Expr::Boolean> ! <Expr::Boolean>
Again, the operands must be of type
Boolean, there are no implicit
conversions. The not operator binds more tightly than the and operator, which binds more tightly than the or operator, as you would expect. These operators DO short-circuit evaluation.