summaryrefslogtreecommitdiff
path: root/compiler/utils/Binary.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-11-25 16:26:23 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2015-11-25 16:30:49 +0000
commit924f851700ca9ba7e0e7483b7ca4de62a4a74e15 (patch)
treebcacf0da46fea79b1809bbde1a72f21d57c84a27 /compiler/utils/Binary.hs
parent9032d0565f6a6f1e63e6d0ba79ee2371b9d823fc (diff)
downloadhaskell-924f851700ca9ba7e0e7483b7ca4de62a4a74e15.tar.gz
Refactor default methods (Trac #11105)
This patch does some signficant refactoring to the treatment of default methods in class declarations, and more generally to the type checking of type/class decls. Highlights: * When the class has a generic-default method, such as class C a where op :: a -> a -> Bool default op :: Ord a => a -> a -> a the ClassOpItem records the type of the generic-default, in this case the type (Ord a => a -> a -> a) * I killed off Class.DefMeth in favour of the very-similar BasicTypes.DefMethSpec. However it turned out to be better to use a Maybe, thus Maybe (DefMethSpec Type) with Nothing meaning "no default method". * In TcTyClsDecls.tcTyClGroup, we used to accumulate a [TyThing], but I found a way to make it much simpler, accumulating only a [TyCon]. Much less wrapping and unwrapping. * On the way I also fixed Trac #10896 in a better way. Instead of killing off all ambiguity checks whenever there are any type errors (the fix in commit 8e8b9ed), I instead recover in TcTyClsDecls.checkValidTyCl. There was a lot of associated simplification all round
Diffstat (limited to 'compiler/utils/Binary.hs')
-rw-r--r--compiler/utils/Binary.hs11
1 files changed, 0 insertions, 11 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index 5083804d6f..ab5b772eec 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -807,17 +807,6 @@ instance Binary InlineSpec where
2 -> return Inlinable
_ -> return NoInline
-instance Binary DefMethSpec where
- put_ bh NoDM = putByte bh 0
- put_ bh VanillaDM = putByte bh 1
- put_ bh GenericDM = putByte bh 2
- get bh = do
- h <- getByte bh
- case h of
- 0 -> return NoDM
- 1 -> return VanillaDM
- _ -> return GenericDM
-
instance Binary RecFlag where
put_ bh Recursive = do
putByte bh 0