[GHC] #11534: Allow class associated types to reference functional dependencies

GHC ghc-devs at haskell.org
Wed Feb 3 19:13:18 UTC 2016


#11534: Allow class associated types to reference functional dependencies
-------------------------------------+-------------------------------------
           Reporter:  ekmett         |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.10.3
  (Type checker)                     |
           Keywords:  TypeFamilies,  |  Operating System:  Unknown/Multiple
  FunctionalDependencies             |
       Architecture:                 |   Type of failure:  Other
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Consider:

 {{{#!hs
 class Foo i j | i -> j where
    type Bar i :: *
    type Bar i = j
 }}}

 This is rejected as `j` is not an argument to `Bar`, but when we realize
 any instance `j` will be a known type, determined by `i`, as told to us by
 the | i -> j functional dependency on the class.

 This would likely require some sort of extra pass over the instances with
 class associated types of this form to elaborate them, or a slight
 modification of the default signature implementation for class associated
 types.

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


More information about the ghc-tickets mailing list