[GHC] #9242: Implement {-# OVERLAPPABLE #-} and {-# INCOHERENT #-} pragmas

GHC ghc-devs at haskell.org
Mon Jun 30 00:37:45 UTC 2014


#9242: Implement {-# OVERLAPPABLE #-} and {-# INCOHERENT #-} pragmas
-------------------------------------+------------------------------------
        Reporter:  simonpj           |            Owner:  diatchki
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by Iavor S. Diatchki <iavor.diatchki@…>):

 In [changeset:"6290eeadf61a40f2eb08d0fd7ef1f3b7f9804178/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="6290eeadf61a40f2eb08d0fd7ef1f3b7f9804178"
 Overlapable pragmas for individual instances (#9242)

 Programmers may provide a pragma immediately after the `instance` keyword
 to control the overlap/incoherence behavior for individual instances.
 For example:

     instance {-# OVERLAP #-} C a where ...

 I chose this notation, rather than the other two outlined in the ticket
 for these reasons:

    1. Having the pragma after the type looks odd, I think.
    2. Having the pragma after there `where` does not work for
        stand-alone derived instances

 I have implemented 3 pragams:

    1. NO_OVERLAP
    2. OVERLAP
    3. INCOHERENT

 These correspond directly to the internal modes currently supported by
 GHC.  If a pragma is specified, it will be used no matter what flags are
 turned on.   For example, putting `NO_OVERLAP` on an instance will mark
 it as non-overlapping, even if `OVERLAPPIN_INSTANCES` is turned on for the
 module.
 }}}

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


More information about the ghc-tickets mailing list