[Haskell-cafe] (no subject)

Claus Reinke claus.reinke at talk21.com
Sun May 31 06:56:33 EDT 2009

>> ------------------------------------------
>> type F a = Int
>> class A a where
>>  foo :: A b => a (F b)
>> ------------------------------------------
>> GHC - OK
>> Hugs - Illegal type "F b" in constructor application
> This time, I'd say Hugs is wrong (though eliminating that initial
> complaint leads back to an ambiguous and unusable method 'foo').

I only just recognized the horrible error message from the first
example.. what Hugs is trying to tell us about is a kind error!

The kind of 'a' in 'F' defaults to '*', but in 'A', 'F' is applied to
'b', which, via 'A b' is constrained to '*->*'. So Hugs is quite
right (I should have known!-).

The error message can be improved drastically, btw:

    :set +k
    ERROR file:.\hugs-vs-ghc.hs:19 - Kind error in constructor application
    *** expression : F b
    *** constructor : b
    *** kind : a -> b
    *** does not match : *

See http://cvs.haskell.org/Hugs/pages/hugsman/started.html and
search for '+k' - highly recommended if you're investigating kinds.


More information about the Haskell-Cafe mailing list