[commit: ghc] master: Overlapable pragmas for individual instances (#9242) (6290eea)
git at git.haskell.org
git at git.haskell.org
Mon Jun 30 00:37:52 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/6290eeadf61a40f2eb08d0fd7ef1f3b7f9804178/ghc
>---------------------------------------------------------------
commit 6290eeadf61a40f2eb08d0fd7ef1f3b7f9804178
Author: Iavor S. Diatchki <iavor.diatchki at gmail.com>
Date: Sun Jun 29 17:22:16 2014 -0700
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.
>---------------------------------------------------------------
6290eeadf61a40f2eb08d0fd7ef1f3b7f9804178
compiler/hsSyn/Convert.lhs | 2 +-
compiler/hsSyn/HsDecls.lhs | 24 ++++++++++++++++----
compiler/parser/Lexer.x | 6 +++++
compiler/parser/Parser.y.pp | 21 +++++++++++++-----
compiler/rename/RnSource.lhs | 7 ++++--
compiler/typecheck/TcDeriv.lhs | 46 +++++++++++++++++++++++++--------------
compiler/typecheck/TcInstDcls.lhs | 5 ++++-
7 files changed, 82 insertions(+), 29 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6290eeadf61a40f2eb08d0fd7ef1f3b7f9804178
More information about the ghc-commits
mailing list