3 Main Features of Curry

3.3 Predefined Types

A type is a set of values. Ubiquitous types, such as integers or characters, are predefined by most programming languages. Curry makes no exception. These types are referred to as builtin and are denoted with a familiar, somewhat special, syntax. Both the availability of builtin types and their characteristics may depend on a specific implementation of Curry. The following table summarizes some types available in PAKCS.

Type Declaration Examples
Integer Int ...,-2,-1,0,1,2,...
Boolean Bool False, True
Character Char 'a','b','c',...,'\n',...
String String "hello", "world"
List of τ [τ] [], [0,1,2], 0:1:2:[]
Unit () ()

The details of these types are found in the PAKCS User Manual. Below, we only outline a few crucial characteristics of the builtin types. The integers have arbitrary precision. Some frequently used non-printable characters are denoted, as in other popular programming languages, by escape sequences, e.g., newline is denoted by \n. The type List represents sequences of values. This type is polymorphic, i.e., for any type τ, the type list of τ, denoted by “[τ]”, is a type whose instances are sequences of instances of τ. The last two examples in the List row of the table denote a list of integers, their type denoted by “[Int]”. The notation of lists will be further discussed later. The symbol “()” denotes the unit type as well as the only element of this type. The unit type is useful in situations where the return value of a function is not important. Another useful type available in PAKCS, the tuple, will be described later.