diff options
author | Iavor S. Diatchki <iavor.diatchki@gmail.com> | 2014-07-27 13:02:37 -0700 |
---|---|---|
committer | Iavor S. Diatchki <iavor.diatchki@gmail.com> | 2014-07-27 13:03:05 -0700 |
commit | 97f499b56c5888740ddb147fb198c28a3c06bac7 (patch) | |
tree | 98a1dc54c41d79b0ecd5ec9f3c3ae2ee6bdfaa86 /compiler/utils/Binary.hs | |
parent | 9487305393307d5eb34069c5821c11bb98b5ec90 (diff) | |
download | haskell-97f499b56c5888740ddb147fb198c28a3c06bac7.tar.gz |
Implement OVERLAPPING and OVERLAPPABLE pragmas (see #9242)
This also removes the short-lived NO_OVERLAP pragama, and renames
OVERLAP to OVERLAPS.
An instance may be annotated with one of 4 pragams, to control its
interaction with other overlapping instances:
* OVERLAPPABLE:
this instance is ignored if a more specific candidate exists
* OVERLAPPING:
this instance is preferred over more general candidates
* OVERLAPS:
both OVERLAPPING and OVERLAPPABLE (i.e., the previous GHC behavior).
When compiling with -XOverlappingInstances, all instance are OVERLAPS.
* INCOHERENT:
same as before (see manual for details).
When compiling with -XIncoherentInstances, all instances are INCOHERENT.
Diffstat (limited to 'compiler/utils/Binary.hs')
-rw-r--r-- | compiler/utils/Binary.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 82d1497ee6..0aa8c648b8 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -834,15 +834,19 @@ instance Binary RecFlag where _ -> do return NonRecursive instance Binary OverlapMode where - put_ bh NoOverlap = putByte bh 0 - put_ bh OverlapOk = putByte bh 1 - put_ bh Incoherent = putByte bh 2 + put_ bh NoOverlap = putByte bh 0 + put_ bh Overlaps = putByte bh 1 + put_ bh Incoherent = putByte bh 2 + put_ bh Overlapping = putByte bh 3 + put_ bh Overlappable = putByte bh 4 get bh = do h <- getByte bh case h of 0 -> return NoOverlap - 1 -> return OverlapOk + 1 -> return Overlaps 2 -> return Incoherent + 3 -> return Overlapping + 4 -> return Overlappable _ -> panic ("get OverlapMode" ++ show h) |