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

GHC ghc-devs at haskell.org
Mon Feb 8 21:16:44 UTC 2016


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

Comment (by simonpj):

 Interesting. I suppose you could say
 {{{
 type family S m :: *
 class B m where {}

 type instance S Int = ()
 instance B Int
 }}}
 Now you can say
 {{{
 type instance S X = ()
 newtype X = X Int deriving( B )
 }}}
 This supplies the extra information nominally, whereas the fundep notation
 supplies it positionally.

 It might be advantageous to be able to give an associated type instance
 outside of a class instance decl.

 Thanks for the example.  The problem is notational rather than
 fundamental; but still I can see it's annoying.

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


More information about the ghc-tickets mailing list