Curry: An Integrated Functional Logic Language
Curry: An Integrated Functional Logic Language
Curry: An Integrated Functional Logic Language
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
❀ {x=1,y=3}<br />
(The empty constraint is omitted in the final answer.)<br />
4 Types<br />
4.1 Built-in Types<br />
This section describes the types that are predefined in <strong>Curry</strong>. For each type, some important<br />
operations are discussed. The complete definition of all operations can be found in the standard<br />
prelude (see Appendix B).<br />
4.1.1 Boolean Values<br />
Boolean values are predefined by the datatype declaration<br />
data Bool = True | False<br />
The (sequential) conjunction is predefined as the left-associative infix operator &&:<br />
(&&) :: Bool -> Bool -> Bool<br />
True && x = x<br />
False && x = False<br />
Similarly, the (sequential) disjunction || and the negation not are defined as usual (see Appendix<br />
B). Furthermore, the function otherwise is predefined as True to write rules with multiple<br />
guards more nicely.<br />
Boolean values are mainly used in conditionals, i.e., the conditional function if_then_else is<br />
predefined as<br />
if_then_else :: Bool -> a -> a -> a<br />
if True then x else y = x<br />
if False then x else y = y<br />
where “if b then x else y” is syntactic sugar for the application (if_then_else b x y).<br />
A function with result type Bool is often called a predicate (in contrast to constraints which<br />
have result type Success, see below). 7 There are a number of built-in predicates for comparing<br />
objects, like the predicate “