[Haskell-cafe] Kind of confusing

Max Bolingbroke batterseapower at hotmail.com
Tue May 12 07:02:55 EDT 2009


Hi Anton,

AFAIK the only place this is documented is in GHC source code. Please
see the section called "Main data types representing Kinds" at
http://hackage.haskell.org/packages/archive/ghc/6.10.2/doc/html/Type.html.

Basically, they are all members of GHC's internal subkind hierarchy,
which is used to distinguish between the representation of types.

For example, the "error" function can be instantiated to have the type
String -> Int# -> Int# whereas every polymorphic function you write
will only be able to be instantiated at lifted types like Int. This
reflects the fact that internally the type variable in the type of
"error" has (IIRC) kind "?". I don't know why they showed up in your
error message!

Cheers,
Max

2009/5/12 Anton van Straaten <anton at appsolutions.com>:
> GHC amused me today with this error (context omitted):
>
>    Couldn't match kind `(* -> *) -> * -> *' against `?? -> ? -> *'
>    When matching the kinds of `t :: (* -> *) -> * -> *' and
>                               `(->) :: ?? -> ? -> *'
>
> It was a silly mistake: I had used 'lift' where I intended to use 'liftM'.
>
> But I'm thinking Haskell compilers should have some sort of option which,
> when the ratio of punctuation to alphanumerics in an error message exceeds a
> certain level, just responds to the user with a more readily comprehensible
> message such as "WTF, dude?"
>
> Serious question: what is the significance of the question mark and double
> question marks in those signatures, or better yet, where can I read about
> it?
>
> Anton
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


More information about the Haskell-Cafe mailing list