Skip to content

Functional dependency coverage check does not use type equalities

When checking the coverage condition to validate an instance, we should also consider equality constraints because they have a dependency in both directions.

class C a b | a -> b
instance (a ~ b) => C a b

--  Illegal instance declaration for ‛C a b’
--    The coverage condition fails in class ‛C’
--      for functional dependency: ‛a -> b’
--    Reason: lhs type ‛a’ does not determine rhs type ‛b’
--    Using UndecidableInstances might help
--  In the instance declaration for ‛C a b’
Trac metadata
Trac field Value
Version 7.6.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC iavor.diatchki@gmail.com
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information