summaryrefslogtreecommitdiff
path: root/compiler/utils/Binary.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils/Binary.hs')
-rw-r--r--compiler/utils/Binary.hs19
1 files changed, 17 insertions, 2 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index 498c4924de..1c52cb56fb 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -1380,10 +1380,24 @@ instance Binary RealSrcSpan where
return (mkRealSrcSpan (mkRealSrcLoc f sl sc)
(mkRealSrcLoc f el ec))
+instance Binary BufPos where
+ put_ bh (BufPos i) = put_ bh i
+ get bh = BufPos <$> get bh
+
+instance Binary BufSpan where
+ put_ bh (BufSpan start end) = do
+ put_ bh start
+ put_ bh end
+ get bh = do
+ start <- get bh
+ end <- get bh
+ return (BufSpan start end)
+
instance Binary SrcSpan where
- put_ bh (RealSrcSpan ss) = do
+ put_ bh (RealSrcSpan ss sb) = do
putByte bh 0
put_ bh ss
+ put_ bh sb
put_ bh (UnhelpfulSpan s) = do
putByte bh 1
@@ -1393,7 +1407,8 @@ instance Binary SrcSpan where
h <- getByte bh
case h of
0 -> do ss <- get bh
- return (RealSrcSpan ss)
+ sb <- get bh
+ return (RealSrcSpan ss sb)
_ -> do s <- get bh
return (UnhelpfulSpan s)