projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New syntax for GADT-style record declarations, and associated refactoring
[ghc-hetmet.git]
/
compiler
/
utils
/
Binary.hs
diff --git
a/compiler/utils/Binary.hs
b/compiler/utils/Binary.hs
index
4f48a42
..
cbfec74
100644
(file)
--- a/
compiler/utils/Binary.hs
+++ b/
compiler/utils/Binary.hs
@@
-67,6
+67,7
@@
import Panic
import UniqFM
import FastMutInt
import Fingerprint
import UniqFM
import FastMutInt
import Fingerprint
+import BasicTypes
import Foreign
import Data.Array
import Foreign
import Data.Array
@@
-82,10
+83,15
@@
import System.IO.Unsafe ( unsafeInterleaveIO )
import System.IO.Error ( mkIOError, eofErrorType )
import GHC.Real ( Ratio(..) )
import GHC.Exts
import System.IO.Error ( mkIOError, eofErrorType )
import GHC.Real ( Ratio(..) )
import GHC.Exts
-import GHC.IOBase ( IO(..) )
import GHC.Word ( Word8(..) )
import System.IO ( openBinaryFile )
import GHC.Word ( Word8(..) )
import System.IO ( openBinaryFile )
+#if __GLASGOW_HASKELL__ >= 611
+import GHC.IO ( IO(..) )
+#else
+import GHC.IOBase ( IO(..) )
+#endif
+
type BinArray = ForeignPtr Word8
---------------------------------------------------------------
type BinArray = ForeignPtr Word8
---------------------------------------------------------------
@@
-726,3
+732,13
@@
instance Binary Fingerprint where
put_ h (Fingerprint w1 w2) = do put_ h w1; put_ h w2
get h = do w1 <- get h; w2 <- get h; return (Fingerprint w1 w2)
put_ h (Fingerprint w1 w2) = do put_ h w1; put_ h w2
get h = do w1 <- get h; w2 <- get h; return (Fingerprint w1 w2)
+instance Binary FunctionOrData where
+ put_ bh IsFunction = putByte bh 0
+ put_ bh IsData = putByte bh 1
+ get bh = do
+ h <- getByte bh
+ case h of
+ 0 -> return IsFunction
+ 1 -> return IsData
+ _ -> panic "Binary FunctionOrData"
+