
#9918: GHC chooses an instance between two overlapping, but cannot resolve a clause within the similar closed type family -------------------------------------+------------------------------------- Reporter: qnikst | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by qnikst): Seems I understood Simon differently. As far as I understood he advices make check for classes more strict, and less strict. So 1. For classes instances: {{{ instance F a (M a) where ... instance F a a where ... }}} Will no longer be accepted due to surely-apart check. And Equals typefamily will have the same rules as it has now. 2. As less programs will be accepted, and some really relies on the current behaviour, it's possible to introduce `{-# UNDECIDABLE #-}` pragma for type class that will remove new "surely-apart" check and instances will be accepted 3. (Simon didn't say it). In order to unify type families and type class bevaiour it's possible to allow `{-# UNDECIDANBLE #-}` pragma to be applied to type family. Yes, if it will be applied to a typefamily that should have surely-apart check (e.g. `Equals`) it will be broken. However if programmer takes responsibility and guarantee that this check is not needed (2 examples above) then he can use this pragma in order to make compiler accept this program. So as far as I understood this suggestion doesn't allow any new ill-typed program to be accepted, more over some programs that are accepted now will not be accepted then, but proposal provides a backdoor so programmer can have old behaviour. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9918#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler