[Haskell-cafe] how to avoid overlapping instance error?
S. Alexander Jacobson
alex at alexjacobson.com
Fri Feb 25 12:09:09 EST 2005
Currently, the HAppS.DBMS lib requires the user to provide a Show
instance for their table types. An example might be:
instance (Show item) => Show (MyTable item) where
showsPrec d table = showsPrec d $ Set.toList $ myTableSet table
But the Table class itself defines a toSet function so I think I
should be able to do this once for all Table instances:
instance (Show item,Ord item, Table table item p) => Show (table item) where
showsPrec d table = showsPrec d $ Set.toList $ toSet table
But I get an error telling me I am overlapping with Show [a].
Since [] is not an instance of Table, I don't see why there should be
an overlap.
-Alex-
______________________________________________________________
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com
More information about the Haskell-Cafe
mailing list