[Haskell-cafe] wierd type errros with MPTCs

S. Alexander Jacobson alex at alexjacobson.com
Thu Jan 27 12:53:24 EST 2005

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.  But, if I then uncomment 
the default implementation of union, I get:

       No instance for (Table DBTable indexVal)
         arising from use of `Main.$dmunion' at example.hs:13
       In the definition of `union': union = Main.$dmunion
       In the definition for method `union'
       In the instance declaration for `Table DBTable IVal'

I don't know what this error even means.  But it 
goes away if I put the union implementation in the 
instance rather than in the class.

Bot these error messages seem unreasonable.  Can 
someone clarify?

Note: I am using GHC 6.2.2


S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com

More information about the Haskell-Cafe mailing list