functional dependencies and overlapping instances
Hi, this reports two bugs in Hugs98-feb2000 and provides a fix for the first and a proposed fix for the second. 1. Given the definitions
class NextState s t s' | s t -> s' instance NextState EMPTY t EMPTY instance NextState EPSILON t EMPTY instance NextState (ATOM t) t EPSILON instance NextState (ATOM t) t' EMPTY
instance NextState (ATOM t) t EPSILON is definitely more specific than instance NextState (ATOM t) t' EMPTY
hugs -98 +o complains that ERROR "REGEXP.hs" (line 76): Instances are not consistent with dependencies *** This instance : NextState (ATOM a) b EMPTY *** Conflicts with : NextState EMPTY a EMPTY *** For class : NextState a b c *** Under dependency : a b -> c Oops, the "Conflicts with" line is not right, it should rather be *** Conflicts with : NextState (ATOM a) a EPSILON The patch below corrects this. 2. But actually, since we are allowing overlapping instances and the the above definitions should be perfectly ok. The patch below fixes the generation of the error message, but other fixes might be necessary, too. Cheers Peter
participants (1)
-
Peter Thiemann