X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FBinary.hs;h=cbfec74cff1077464a1e3448c5f5f8a5d3d1951b;hb=432b9c9322181a3644083e3c19b7e240d90659e7;hp=4f48a424b317ca970785365998cfc338cd1a23a8;hpb=9bcd95bad83ee937c178970e8b729732e680fe1e;p=ghc-hetmet.git diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 4f48a42..cbfec74 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -67,6 +67,7 @@ import Panic import UniqFM import FastMutInt import Fingerprint +import BasicTypes 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 GHC.IOBase ( IO(..) ) 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 --------------------------------------------------------------- @@ -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) +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" +