[GHC] #11432: Cannot export operator newtype

GHC ghc-devs at haskell.org
Fri Jan 15 21:39:11 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):

 As `Note [Type constructors in export list]` says, type/variable
 constructors in export lists introduce ambiguity in grammar:

 {{{
 Mixing type constructors and variable constructors in export lists
 introduces
 ambiguity in grammar: e.g. (*) may be both a type constuctor and a
 function.

 -XExplicitNamespaces allows to disambiguate by explicitly prefixing type
 constructors with 'type' keyword.

 This ambiguity causes reduce/reduce conflicts in parser, which are always
 resolved in favour of variable constructors. To get rid of conflicts we
 demand
 that ambigous type constructors (those, which are formed by the same
 productions as variable constructors) are always prefixed with 'type'
 keyword.
 Unambigous type constructors may occur both with or without 'type'
 keyword.
 }}}

 Resolving ambiguity by changing grammar is impractical: type/variable
 constructors in export lists are used in exactly the same context (it's
 *not* a lookahead problem).

 This ambiguity can be resolved, but not on parser level: parser should
 parse constructor as 'just some constructor' (wrap it) and delay the
 actual decision to the next phase.

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


More information about the ghc-tickets mailing list