summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-09-28 15:53:45 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2012-09-28 15:53:45 +0100
commit6e3e64aeda1add215ffccca87931a60e4f8b53e5 (patch)
treea8cc5dd835ed86fb02f746969cf0cb376942f6b2 /compiler/utils
parent9a058b173a6e12296ac302a6ccd22d9c8f0a09d0 (diff)
parent42cb30bd2c00705da598cc8d4170b41fb5693166 (diff)
downloadhaskell-6e3e64aeda1add215ffccca87931a60e4f8b53e5.tar.gz
Merge remote-tracking branch 'origin/master' into tc-untouchables
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/Bag.lhs1
-rw-r--r--compiler/utils/Serialized.hs10
2 files changed, 11 insertions, 0 deletions
diff --git a/compiler/utils/Bag.lhs b/compiler/utils/Bag.lhs
index a32991b97d..a83397898e 100644
--- a/compiler/utils/Bag.lhs
+++ b/compiler/utils/Bag.lhs
@@ -268,5 +268,6 @@ instance Data a => Data (Bag a) where
toConstr _ = abstractConstr $ "Bag("++show (typeOf (undefined::a))++")"
gunfold _ _ = error "gunfold"
dataTypeOf _ = mkNoRepType "Bag"
+ dataCast1 x = gcast1 x
\end{code}
diff --git a/compiler/utils/Serialized.hs b/compiler/utils/Serialized.hs
index 26cca6c386..902d2feea0 100644
--- a/compiler/utils/Serialized.hs
+++ b/compiler/utils/Serialized.hs
@@ -95,16 +95,26 @@ deserializeConstr bytes k = deserializeWord8 bytes $ \constr_ix bytes ->
x -> error $ "deserializeConstr: unrecognised serialized constructor type " ++ show x ++ " in context " ++ show bytes
+#if __GLASGOW_HASKELL__ < 707
serializeFixedWidthNum :: forall a. (Num a, Integral a, Bits a) => a -> [Word8] -> [Word8]
serializeFixedWidthNum what = go (bitSize what) what
+#else
+serializeFixedWidthNum :: forall a. (Num a, Integral a, FiniteBits a) => a -> [Word8] -> [Word8]
+serializeFixedWidthNum what = go (finiteBitSize what) what
+#endif
where
go :: Int -> a -> [Word8] -> [Word8]
go size current rest
| size <= 0 = rest
| otherwise = fromIntegral (current .&. 255) : go (size - 8) (current `shiftR` 8) rest
+#if __GLASGOW_HASKELL__ < 707
deserializeFixedWidthNum :: forall a b. (Num a, Integral a, Bits a) => [Word8] -> (a -> [Word8] -> b) -> b
deserializeFixedWidthNum bytes k = go (bitSize (undefined :: a)) bytes k
+#else
+deserializeFixedWidthNum :: forall a b. (Num a, Integral a, FiniteBits a) => [Word8] -> (a -> [Word8] -> b) -> b
+deserializeFixedWidthNum bytes k = go (finiteBitSize (undefined :: a)) bytes k
+#endif
where
go :: Int -> [Word8] -> (a -> [Word8] -> b) -> b
go size bytes k