summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Binary.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Utils/Binary.hs')
-rw-r--r--compiler/GHC/Utils/Binary.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/GHC/Utils/Binary.hs b/compiler/GHC/Utils/Binary.hs
index 5bcc98cff4..d73939c53c 100644
--- a/compiler/GHC/Utils/Binary.hs
+++ b/compiler/GHC/Utils/Binary.hs
@@ -1448,6 +1448,23 @@ instance Binary BufSpan where
end <- get bh
return (BufSpan start end)
+instance Binary UnhelpfulSpanReason where
+ put_ bh r = case r of
+ UnhelpfulNoLocationInfo -> putByte bh 0
+ UnhelpfulWiredIn -> putByte bh 1
+ UnhelpfulInteractive -> putByte bh 2
+ UnhelpfulGenerated -> putByte bh 3
+ UnhelpfulOther fs -> putByte bh 4 >> put_ bh fs
+
+ get bh = do
+ h <- getByte bh
+ case h of
+ 0 -> return UnhelpfulNoLocationInfo
+ 1 -> return UnhelpfulWiredIn
+ 2 -> return UnhelpfulInteractive
+ 3 -> return UnhelpfulGenerated
+ _ -> UnhelpfulOther <$> get bh
+
instance Binary SrcSpan where
put_ bh (RealSrcSpan ss sb) = do
putByte bh 0