[Haskell-beginners] Extract and integer from a ByteString

Yitzchak Gale gale at sefer.org
Wed Jun 16 05:23:11 EDT 2010


I wrote:
> import Data.Binary.Get
> ...
>    n <- fmap (runGet word32be) $ L.hGet h 4
>    theString <- L.hGet h n

Oops, you also need to convert from Word32 to Int:

  n <- fmap (fromIntegral . runGet word32be) $ L.hGet h 4

Regards,
Yitz


More information about the Beginners mailing list