Quantified Types

They are also known as polymorhphic types.

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

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

  1. > id 1
  2. 1

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

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