1.4 Expressions and Values
Examples of expressions are atomic values such as
'a'. There are also structured expressions such as a list of pitches, or pair of character and integer. Strings are also expressions and all of these are also values since there is no further computaion that can be done.
Expressions whose definitions result in a never ending sequence of calculations are said to diverge.
The symbol ⊥ represents the value of such expressions since the there is nothing to distinguish one divergent expression from another.
Every expression and value has a type and the association of an expression with its type is called a type signature. Haskell ensures programs are well typed.
1.6 Function Types and Type Signatures
Returning to the earlier example of the simple function we can write its type signature as:
simple :: Integer -> Integer -> Integer -> Integer = x * (y + z)simple x y z
Its a good idea to write the type before creating the function you want to define. Use of a function is called function application. Function application always has higher precedence than operator application. For example:
+ g y f x ⇒ (f x) + (g y)
Despite the difference operators are still just functions.