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

GHC ghc-devs at haskell.org
Sun Mar 20 19:09:14 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 goldfire):

 Replying to [comment:27 dfeuer]:
 > If people want to go forward with desugaring fundeps to type families
 (sounds great to me), I think it would be lovely to add naming syntax:
 >
 > {{{#!hs
 > class Foo a b c d | (Q, R :: a -> b c), (S :: b d -> a)
 > }}}
 >

 I tend to like the option to give names, but I cringe at this syntax. The
 `::` in there activates my brain's type parser. Then, that parser
 successfully processes `a -> b c`. But then my brain experiences quite a
 jarring type error when it tries to treat the result of that parse as a
 functional dependency.

 I have no better suggestion here, and I would probably admit that this is
 the best available syntax. I just hate experiencing type errors in my
 brain just as much as in my running programs! Haskell generally prevents
 the latter. I have no good idea how to prevent the former, in general.

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


More information about the ghc-tickets mailing list