I need to read the binary format in Haskell. The format is quite simple: four octets indicating the length of the data, followed by the data. Four octets are an integer in network byte order.
How to convert a ByteString from four bytes to an integer? I want direct composition (in C, which would be *(int*)&data ), and not a lexicographic conversion. Also, how would I go for approval? The serialized integer is in network byte order, but the machine may use a different byte order.
I tried Google, but these are just the results of the lexicographic conversion.
user142019
source share