Coverage Condition fails

Adrian Hey ahey at
Sat Dec 30 18:25:36 EST 2006

Hello folks,

Could somebody explain what a coverage condition is and
what this error message means..

"Illegal instance declaration for 'GT (GT2 map1 map2) (k1,k2)'
   (the Coverage Condition fails for one of the functional dependencies)
  In the instance declaration for 'GT (GT2 map1 map2) (k1,k2)'"

The offending code looks like this..

 > -- Generalsed Trie map class
 > class Ord k => GT map k | map -> k , k -> map where

 > -- Map type for pairs
 > newtype (GT2 map1 map2 a) = GT2 (map1 (map2 a))

 > -- Which is an instance of GT
 > instance (GT map1 k1, GT map2 k2) => GT (GT2 map1 map2) (k1,k2) where

This is with ghc 6.6. The strange thing is this code used to compile
fine with earlier versions (but I don't know if it actually worked
because I never tested it).

Adrian Hey

More information about the Glasgow-haskell-users mailing list