[GHC] #10086: Disambiguate type variables using dictionaries

GHC ghc-devs at haskell.org
Fri Feb 13 16:30:50 UTC 2015


#10086: Disambiguate type variables using dictionaries
-------------------------------------+-------------------------------------
        Reporter:  jstolarek         |                   Owner:
            Type:  feature request   |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler (Type    |                 Version:  7.11
  checker)                           |                Keywords:
      Resolution:                    |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  Other             |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 > In this example we call idTF with a Maybe Char argument, which means we
 are using Id (Maybe a) instance.

 But you can't infer that because there could be another instance `TF
 (Either Int a) = Maybe a` that you can't see. Or put differently, adding a
 new (compatible) instance for a type family is not supposed to break any
 uses of that type family.

 If `TF` was a closed type family, then perhaps GHC could make this sort of
 inference. It amounts to checking injectivity "locally" for particular
 types as needed: i.e. check not that `TF x = y` has at most one solution
 for every `y`, but just for the particular `y` that is needed.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10086#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list