
Glynn Clements
decodeOne :: [Word8] -> (Either Error Char, Int, [Word8]) -- 2nd. component: number of bytes consumed, -- 3rd. component: rest of bytes
Huh? Either..or? I can't make sense of the declaration, what's with the commas?
Comments welcome.
I vote for 'decodeChar' for single characters, and just 'decode' for String. FWIW.
3. The basic decoder interface shouldn't attempt to recover from errors. Rather, it should return the list of complete characters, the list of remaining octets, and the final state. Any error recovery should be an optional add-on.
Could error handling be passed as a parameter to the encoder, perhaps? E.g. if I'm not really interested in debugging the code, just extracting what's possible, I could pass an error handler that tries to skip errors and keep going, without having to pollute my higher level code with it? -kzm -- If I haven't seen further, it is by standing in the footprints of giants