Overlapable pragmas for individual instances (#9242)
authorIavor S. Diatchki <iavor.diatchki@gmail.com>
Mon, 30 Jun 2014 00:22:16 +0000 (17:22 -0700)
committerIavor S. Diatchki <iavor.diatchki@gmail.com>
Mon, 30 Jun 2014 00:22:16 +0000 (17:22 -0700)
commit6290eeadf61a40f2eb08d0fd7ef1f3b7f9804178
treea8b94173a7585cd1e7c543e2f76b32e7b6f31db1
parent9982715002edfd789926fd4ccd42bea284a67939
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.
compiler/hsSyn/Convert.lhs
compiler/hsSyn/HsDecls.lhs
compiler/parser/Lexer.x
compiler/parser/Parser.y.pp
compiler/rename/RnSource.lhs
compiler/typecheck/TcDeriv.lhs
compiler/typecheck/TcInstDcls.lhs