
27 Nov
2009
27 Nov
'09
4:14 p.m.
В сообщении от Пятница 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?