Control Structures¶
Case Expressions¶
The syntax for a case expression is:
case <expression> of {
| <pat1> := <branch1>
..
| <patN> := <branchN>
}
For instance, evaluation of the following expression in the REPL yields 1
:
Stdlib.Prelude> case 2 of { | zero := 0 | suc x := x }
1
Lazy Builtins¶
The standard library offers several lazily evaluated builtin functions. These must be fully applied.
if condition branch1 branch2
: Evaluatescondition
first, returnsbranch1
if true, else returnsbranch2
.a || b
: Lazy disjunction. Evaluatesa
first, returns true if true, else evaluates and returnsb
.a && b
: Lazy conjunction. Evaluatesa
first, returns false if false, else evaluates and returnsb
.a >> b
: Sequences two IO actions, lazy in the second argument.