Search code examples
haskellfunctional-programmingdata-kindstype-kinds

In which way do kinds associate in haskell?


i have given the task to give an example for a type constructor of the kind

* -> (* -> *)

but I can't find one.

My guess is that kinds associate to the right, so that the above given kind is the same as

* -> * -> *

In that case Either would be an example, wouldn't it?


Solution

  • Yes.

    Prelude> :set -XKindSignatures 
    Prelude> :k (Either :: * -> (* -> *))
    (Either :: * -> (* -> *)) :: * -> * -> *
    

    BTW, the * notation will be deprecated. The modern version is called Type.

    Either :: Type -> Type -> Type