[GHC] #11432: Cannot export operator newtype

GHC ghc-devs at haskell.org
Mon Jan 18 23:27:07 UTC 2016


#11432: Cannot export operator newtype
-------------------------------------+-------------------------------------
        Reporter:  phadej            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  8.0.1-rc1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by skvadrik):

 I see two possible ways to resolve this issue.

 * The first way is to change GHC grammar (as shown in attached
 Parser.diff) to distinguish between `(-.->)` and `(-.->)(..)` in export
 lists: the first construct must be recognized as variable constructor,
 while   the second must be type constructor (because it has `(..)`).

   With this patch GHC can parse the reported program (and passes all
 existing tests).

   Note that the patch does not add any new conflicts. However, it is ugly:
 one has to lift low-level nonterminals (variable and type names) all the
 way up to export lists: parser cannot decide whether it is variable or
 type name until it sees subexport.

 * The second way (I have no example patch yet) would be to free grammar of
 all this mess: parse any constructor in export list as just some
 constructor (probably with subexport) and decide which kind it is later.

 So you see, this patch is kind of a demonstration that LALR grammars are
 capable of parsing such things. I'm not happy with this solution; I'd
 rather try the second way.

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


More information about the ghc-tickets mailing list