Quantified Types

Quantified Types

They are also known as polymorhphic types.

> :type id
id :: forall a. a -> a

The key word forallindicates that id is univerally quantified, meaning that id can be applied to any type.

> id 1
1

A more complicated example is flip. flipis also a higher-order function, which will be explained in the later chapter.

> :type flip
forall a b c. (a -> b -> c) - > b -> a -> c