Comment on page
Bool is a logical data type that can be either
Int can contain integers, both negative and positive whole numbers (e.g.
50) up to a certain size which is limited by a fixed amount of memory, hence the term fixed-precision. GHC can hold values in the range of
(2^63 - 1)for Int types - going outside those ranges will yield unexpected results.
Integer is the same as Int except it does not have a limit to the values it can hold. Performance-wise, it is better to use Int if we know our values will not go out of range, as most computers have built-in hardware for dealing with fixed-precision integers.
Float can contain decimal numbers (e.g.
50.0) up to a certain precision which is limited by a fixed amount of memory. The term floating-point comes from this memory limitation, which limits the number of digits (precision) that can come after the decimal point based on the size of the number.
Double is the same type as float, containing decimal numbers but with double the memory assigned for storage for increased precision.
Char is a type for characters – it can hold any Unicode character including control characters such as
'\n'(a new line character) or
'\t'(tab stop character). Char type values must be enclosed in single quotes
Strings simply hold a string of characters – they are in fact a type
[Char](a list of Char type values) in Haskell. Strings must be enclosed in double-quotes
"Haskell is great".