[Haskell] Parsing binary data

Donald Bruce Stewart dons at cse.unsw.edu.au
Sat Aug 27 21:06:34 EDT 2005


joelr1:
> Folks,
> 
> I'm trying to parse chunks of binary data that arrive through a  
> socket. There's a defined format of these chunks where the first 4  
> bytes are an id, then could come a Pascal (size first) string, then  
> some more data.
> 
> I'm trying to figure out how to read and write Haskell data in this  
> format and using a socket.
> 
> Would someone have examples?
> 
>     Thanks, Joel

Maybe you'd like to look at the various Binary implementations?

  http://www.haskell.org/nhc98/libs/Binary.html

You might also survive just using Data.Bits

-- Don


More information about the Haskell mailing list