3 Main Features of Curry

3.4 Predefined Operations

Many frequently-used functions and infix operators, similar to frequently-used types, are predefined in Curry. Some of these can be found in the “Prelude”, a Curry source program automatically loaded when the compiler/interpreter starts. A few others are so fundamental that they are built into the language. Some of these functions and operators are shown in the following table.

Description Ident. Fix. Prec. Type
Boolean equality == 4 a -> a -> Bool
Constrained equality =:= 4 a -> a -> Bool
Boolean conjunction && R 3 Bool -> Bool -> Bool
Boolean disjunction || R 2 Bool -> Bool -> Bool
Parallel conjunction & R 0 Bool -> Bool -> Bool
Constrained expression &> R 0 Bool -> a -> a

Because of non-determinism and free variables, in the following discussion, different evaluations of the same expression may produce different values.
The Boolean equality applied to expressions u and v, i.e., u==v, returns “True” when u and v evaluate to the same value and “False” when they evaluate to different values—a more precise definition will be given later. If the evaluation of u and/or v ends in an expression that still contains functions, e.g., 1 ‘div‘ 0, the computation fails and no value is returned.
The constrained equality applied to expressions u and v, i.e., u=:=v returns “True” when u and v evaluate to the same value—a precise definition will be given later. Otherwise, the computation fails and no value is returned. A key difference between the Boolean and the constrained equalities is how they evaluate expressions containing variables. This will be discussed in some detail in Section 3.14.1.
The Boolean conjunction applied to expressions u and v, i.e., u&&v, returns “True” when u and v evaluate to “True”.
The Boolean disjunction applied to expressions u and v, i.e., u||v, returns “True” when u or v evaluate to “True”.
The parallel conjunction applied to expressions u and v, i.e., u&v, evaluates u and v concurrently. If both succeeds, the evaluation succeeds; otherwise it fails.
The constrained expression applied to a constraint c and an expression e, i.e., c&>e, evaluates first c and, if c evaluates to “True”, then the result is the value of e, otherwise it fails.

Curry predefines many more functions and operations, e.g., the standard arithmetic and relational operators on numbers. A complete list can be found both in the Report and the “Prelude”.