4 Matching Annotations
  1. Dec 2020
  2. Aug 2020
    1. Commonly the above definition is called the identity function. But in fact we should think of it as a whole family of functions. We should really say that id is an identity function for all types a. In other words, for every type T you might come up with, there is an identity function called id, which is of type T -> T. This is the type-checker’s view anyway, and by turning on the RankNTypes extension we can be explicit about that in our code: {-# LANGUAGE RankNTypes #-} id :: forall a. a -> a id x = x

      This is such a nice description of forall. It should be combined with forall is the type-level "lambda" (also saved it here).

    2. In other words you cannot choose the definition of a value based on its type (for now).

      What does this mean?