on master help sign in
Use Int64 over Int while serializing the length of the list
d212793Adithya Kumar
core/src/Streamly/Internal/Data/Serialize/Type.hs+3−3
@@ -223,8 +223,8 @@ instance forall a. Serialize a => Serialize [a] where
223 -- Inlining this causes large compilation times for tests
223 -- Inlining this causes large compilation times for tests
224 {-# INLINABLE deserialize #-}
224 {-# INLINABLE deserialize #-}
225 deserialize off arr sz = do
225 deserialize off arr sz = do
226− (off1, len) <- deserialize off arr sz :: IO (Int, Int)
226+ (off1, len64) <- deserialize off arr sz :: IO (Int, Int64)
227− let
227+ let len = (fromIntegral :: Int64 -> Int) len64
228 peekList f o i | i >= 3 = do
228 peekList f o i | i >= 3 = do
229 -- Unfold the loop three times
229 -- Unfold the loop three times
230 (o1, x1) <- deserialize o arr sz
230 (o1, x1) <- deserialize o arr sz
@@ -240,7 +240,7 @@ instance forall a. Serialize a => Serialize [a] where
240 -- Inlining this causes large compilation times for tests
240 -- Inlining this causes large compilation times for tests
241 {-# INLINABLE serialize #-}
241 {-# INLINABLE serialize #-}
242 serialize off arr val = do
242 serialize off arr val = do
243− void $ serialize off arr (length val)
243+ void $ serialize off arr ((fromIntegral :: Int -> Int64) (length val))
244 let off1 = off + Unbox.sizeOf (Proxy :: Proxy Int)
244 let off1 = off + Unbox.sizeOf (Proxy :: Proxy Int)
245 let pokeList o [] = pure o
245 let pokeList o [] = pure o
246 pokeList o (x:xs) = do
246 pokeList o (x:xs) = do