I&#39;m using the 0.5.1.0 binary package (i.e. Data.Binary/Data.Binary.Get) to encode/decode a lazy bytestring. Unfortunately, decode/get are hanging, possibly due to the underlying chunking logic in Data.Binary.Get.<div><br>
</div><div>The lazy bytestring is being populated from a socket (via &quot;socketTohandle sock ReadWriteMode . hGetContents&quot;). Periodically, encoded data structures are received from the socket. When the encoded data structure happens to end exactly on a chunk boundary, and in my specific case the final encoded item is an Int(64), the Data.Binary.Get.getBytes function wants to force the next chunk to be read into the lazy bytestring before returning the decoded item (see comment in file at line 333 that reads &quot;forces the next chunk before this one is returned&quot;). Unfortunately, since the socket is not yet ready to send anything the call to decode/get hangs. The assumption seems to be that the lazy bytestring isn&#39;t populated from a source that can potentially block.</div>
<div><br></div><div>Is this reading correct?</div><div><br></div><div>If so, are there any workarounds?</div><div><br></div><div>Appreciate any advice - production code.</div>