Perhaps I've figured at least part of this out; is a combination of view and decoded going to give me a constant memory conversion from a ByteString Producer to an MDH Producer? My code now is:
type ErrorResultProducer = P.Producer MDHAndScanLine IO (Either (P.DecodingError, P.Producer P.ByteString IO ()) ()) measDatMDHScanLinePairs :: Handle -> IO (Either P.DecodingError ErrorResultProducer) measDatMDHScanLinePairs h = do hLen <- P.evalStateT (P.decodeGet getWord32le) (PB.fromHandle h) case (hLen :: Either P.DecodingError Word32) of Left err -> return $ Left err Right len -> fmap Right (skipAndProceed h len) where skipAndProceed :: Handle -> Word32 -> IO ErrorResultProducer skipAndProceed handle l = do (hSeek handle AbsoluteSeek) (fromIntegral l) return $ mdhProd (PB.fromHandle handle) mdhProd :: P.Producer P.ByteString IO () -> ErrorResultProducer mdhProd bsProd = view P.decoded bsProd I'm still suspicious of how I'm handling errors here, though. I seem to have something with several layers of Either, and that must be wrong. Thanks again, Dylan -- You received this message because you are subscribed to the Google Groups "Haskell Pipes" group. To unsubscribe from this group and stop receiving emails from it, send an email to haskell-pipes+unsubscr...@googlegroups.com. To post to this group, send email to haskell-pipes@googlegroups.com.