module Main where data Tree a = Leaf a | Tree a :^: Tree a type Example = Tree Int Boolwill cause an error:
ERROR "Main.hs" (line 3): Illegal type "Tree Int Bool" in constructor applicationThe problem here is that Tree is a unary constructor of kind * -> *, but the definition of Example uses it as a binary constructor with at least two arguments, and hence expecting a kind of the form (* -> * -> k), for some kind k.
By default, Hugs reports problems like this with a simple message like the one shown above. However, if the +k option is selected, then the interpreter will print a more detailed version of the error message, including details about the kinds of the type expressions that are involved:
ERROR "Main.hs" (line 3): Kind error in constructor application *** expression : Tree Int Bool *** constructor : Tree *** kind : * -> * *** does not match : * -> a -> bIn addition, if the +k option is used, then Hugs will also include information about kinds in the information produced by the :info command:
Prelude> :info Tree -- type constructor with kind * -> * data Tree a -- constructors: Leaf :: a -> Tree a (:^:) :: Tree a -> Tree a -> Tree a -- instances: instance Eval (Tree a) Prelude>