This * is ... Unhappy. This is the result of the large GHC multikin data type printer. This leads to syntactically invalid words, but it conveys some useful information.
When the GHC nicely prints a type with polymorphic views, it prints the type of each variable of the polymorphic type after the type constructor. OK. Therefore, if you have an ad like:
data Foo (x :: k) y (z :: k2) = Foo y
GHC will print the type Foo (data constructor) as y -> Foo k k1 xyz . If you had any use that pinned a little to one of these type variables, for example ..
foo :: a -> Int -> Foo a Int 5 -- Data Kind promoted Nat
Type foo "hello" 0 will print as Foo * Nat String Int 5 . Yes, thatβs terrible. But if you know what is happening, at least you can read it.
The material '[] is part of the DataKinds extension. This allows you to advertise types by type, and constructors of this type become type constructors. These advanced types do not have valid values, not even undefined , because their type is not compatible with * , which is the type of all types that can have values ββwith them. Therefore, they can appear only in those places where there is no such value. For more information see http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/kind-polymorphism-and-promotion.html
Edit:
Your comment brings up some points about how ghci works.
-- foo.hs {-
When you upload a file to ghci, it does not activate the interactive extensions that were used in the file.
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :l foo [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> :t Foo Foo :: y -> Foo * * xyz *Main> :set -XPolyKinds *Main> :t Foo Foo :: y -> Foo k k1 xyz
So yes. The PolyKinds must be included in ghci so that it defaults to polymorphic types in the type. And I tried to define my Foo function in a file, but it really ruined this version of ghc. Oops I think it is fixed now, but I believe that checking ghc trac would be nice. In any case, I can define it interactively and it works great.
*Main> :set -XDataKinds *Main> let foo :: a -> Int -> Foo a Int 5 ; foo = undefined *Main> :t foo "hello" 0 foo "hello" 0 :: Foo * GHC.TypeLits.Nat [Char] Int 5 *Main> :m + GHC.TypeLits *Main GHC.TypeLits> :t foo "hello" 0 foo "hello" 0 :: Foo * Nat [Char] Int 5
Ok, I forgot that import was needed to display Nat unqualified. And since I was just demonstrating typography, I didn't care about the implementation, so undefined is good enough.
But everything works, as I said, I promise. I just did not talk about what extensions are needed, in particular, both PolyKinds and DataKinds . I assumed that since you used them in your code, you understood them. Here's the documentation for the PolyKinds extension: http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/kind-polymorphism.html