> Instances.hs:1:
>     Duplicate or overlapping instance declarations
>         for `HasConfig (arcTypeConfig value) (arcTypeParms value)'
>             defined at Instances.hs:19 and defined at Instances.hs:11
> 
> This is not fair, because while the instances for HasConfig have the
> potential to conflict in the future, they will only do so should the classes
> NodeTypeConfigParms and ArcTypeConfigParms overlap.

It is fair.  Let's rename your type variables to make what's going on a little clearer:

  main = return ()
  
  class HasConfig a b where
     ($$) :: a -> b -> b
  
  class NodeTypeConfigParms a b where
     nodeTypeConfig :: a c -> b c -> b c
  
  instance (NodeTypeConfigParms a b) => HasConfig (a c) (b c) where
     ($$) = nodeTypeConfig
  
  class ArcTypeConfigParms a b where
     arcTypeConfig :: a c -> b c -> b c
        
  instance (ArcTypeConfigParms a b) => HasConfig (a c) (b c) where
     ($$) = arcTypeConfig
  
  
You can now see that the two instance declarations overlap: their
right hand sides are in fact *identical*.  Remember that the
typechecker simply matches on the right-hand sides ("heads") of the
instance declarations.

If you do -fallow-undecidable-instances, I think your program will
work (in the Prolog-ish backtracking way), but note that if
NodeTypeConfigParms and ArcTypeConfigParms are ever given instances at
the same pair of types, the value of ($$) will be undefined.

--KW 8-)

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to