[Haskell-cafe] Data.Binary and error handling

Khudyakov Alexey alexey.skladnoy at gmail.com
Fri Nov 27 16:14:31 EST 2009


В сообщении от Пятница 27 ноября 2009 23:55:47 вы написали:
> It is quite hard to do a good job of lazy input, but explicit checked
> errors (turning it into an Either Error a makes the whole stream
> strict!).
> 
It does. To a degree. For example if one need to read 8 bytes to decide 
whether parsing fails or succeed parsing will force only these 8 bytes.
With lookalike of runGetState laziness could be reintroduced manually.

runGetStateErr :: Get a -> ByteString -> (Either Err a, Int64, ByteString)

Recovery from errors is not trivial task anyway. And only programmer knows how 
it should be done.


> You might want to look at designs that interleave error tokens in the
> stream.
> 
Could you point out any examples?


More information about the Haskell-Cafe mailing list