Adjust hi-parsing to new interface format.

NB: This will break hs-plugins for all versions of ghc-6.5 before 
2005/07/28 05:57:14 PDT
This commit is contained in:
Thomas Jaeger 2005-08-03 02:52:34 +00:00
parent b0553f9eb8
commit 8c86567be6

View File

@ -343,12 +343,23 @@ instance Binary Int where
#endif #endif
instance Binary a => Binary [a] where instance Binary a => Binary [a] where
#if __GLASGOW_HASKELL__ < 605
get bh = do h <- getWord8 bh get bh = do h <- getWord8 bh
case h of case h of
0 -> return [] 0 -> return []
_ -> do x <- get bh _ -> do x <- get bh
xs <- get bh xs <- get bh
return (x:xs) return (x:xs)
#else
get bh = do
b <- getByte bh
len <- if b == 0xff
then get bh
else return (fromIntegral b :: Word32)
let loop 0 = return []
loop n = do a <- get bh; as <- loop (n-1); return (a:as)
loop len
#endif
instance (Binary a, Binary b) => Binary (a,b) where instance (Binary a, Binary b) => Binary (a,b) where
get bh = do a <- get bh get bh = do a <- get bh