A function type specifies the input and output types of a function value. Haskell writes a unary function type as Int -> Int: the function maps an Int to another Int. section 2.2.3
Function types resemble the functions they describe. A function written as an anonymous lambda can be named, then given a signature that documents the value it accepts and produces. section 2.2.3
Read multi-argument function types from left to right:
- add :: Int -> Int -> Int describes a function taking an Int and producing another function that takes an Int and produces an Int. section 2.2.3
- Parentheses make the nested structure explicit: Int -> (Int -> Int). Haskell commonly omits them as syntactic sugar. section 2.2.3
- The final type is conventionally called the return type, while earlier types describe the arguments. section 2.2.3
square :: Int -> Int square = \x -> x * x
Use the complete square definition to connect a lambda expression with its function type. section 2.2.3
add :: Int -> Int -> Int add = \x -> \y -> x + y
Compare the curried add function with its two-argument lambda form. section 2.2.3
Types also expose constraints imposed by operators. Although (*) works with numeric values, multiplying an Int by a Double produces a type error because both operands must share the required type. section 2.2.4
Character rotation
An encryption routine can describe a character-rotation function as Int -> Char -> Char: an offset is supplied first, followed by a character, producing a character. section 2.2.4
Typed functions in a synthesizer
An Oscillator can wrap an Event -> Signal function. Different oscillators reuse the same shape while varying their waveform and ADSR parameters. section 10.3.2



