Base types

Base types #

A base type in Haskell intuitively represents a set of values (like in Java, and many other languages).

Here are a few native base types:

type meaning syntax of constants in Haskell
Char a Unicode character, like b, B, 5, _ or \t. 'b', 'B', '5', '_' or '\t' (single quotes)
String a sequence of Unicode characters, like banana or f?#\t5 "banana" or "f?#\t5" (double quotes)
Bool a Boolean value True or False
Integer an arbitrary integer (i.e. an element of $\mathbb{Z}$) -42, 0 or 3
Int an integer within a certain range, from $- 2^{63}$ to $2^{63} -1$ (i.e. 64 bits) by default. -42, 0 or 3
Float a 32 bits floating-point number -42, 4472, 4472.0 or 4472.1357