[GHC] #10996: family is treated as keyword in types even without TypeFamilies enabled

GHC ghc-devs at haskell.org
Wed Oct 21 23:14:50 UTC 2015


#10996: family is treated as keyword in types even without TypeFamilies enabled
-------------------------------------+-------------------------------------
        Reporter:  oerjan            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  low               |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  GHC rejects       |            Test Case:  type Test
  valid program                      |  family = family
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by oerjan):

 As I said, in principle there may be no real ambiguity, but unfortunately
 it seems like the head of these constructions is parsed as a `type`
 (nonterminal) token, and the check for whether it is of the right form is
 only done ''after'' the `Happy` parsing:

 {{{
 Prelude> :set -XTypeFamilies
 Prelude> type family' a = a

 <interactive>:28:6:
     Malformed head of type or class declaration: family' a
 Prelude> type family a = a

 <interactive>:30:13: Malformed head of type or class declaration: a
 }}}

 A token that parses those and only those `type`s that can appear as the
 head of these declarations (in particular, disallowing ''applied'' type
 variables) might solve this problem. (Unless, of course, there's some
 ambiguous case that I've forgotten, but that should hopefully show up as a
 reduce/* conflict.)

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


More information about the ghc-tickets mailing list