[Haskell-cafe] wierd type errros with MPTCs

Tomasz Zielonka tomasz.zielonka at gmail.com
Thu Jan 27 12:58:50 EST 2005


On Thu, Jan 27, 2005 at 12:53:24PM -0500, S. Alexander Jacobson wrote:
> This code gives me a Kind error because IVal isn't 
> applied to enough type arguments.
> 
>       import qualified Set
> 
>       class Table table indexVal | indexVal->table where
>           --insertIndex::item->indexVal item -> table item ->table item
>           union::table item -> table item -> table item
>           --union t1 t2 = t1
> 
>       data DBTable item = DBTable
>       data IVal item = Name item
> 
>       instance Table DBTable (IVal ) where
> 
> Weirdly, when I uncomment the insertIndex 
> function, things work.

That's because Haskell has to commit to some kind for indexVal and
without any hits it chooses kind *. You can explicitly state the kind of
indexVal.

    class Table table (indexVal :: * -> *) | indexVal->table where

I can't help you with the other problem. The Main.$dmunion name in the
message is indeed scary.

Best regards,
Tomasz


More information about the Haskell-Cafe mailing list