[Haskell-cafe] Data.Binary, Data.Text and errors

Alexander Dunlap alexander.dunlap at gmail.com
Sun Mar 15 23:40:12 EDT 2009

Hi all,

I have noticed that in both Data.Binary and Data.Text (which is still
experimental, but still), the "decode" functions can be undefined
(i.e. bottom) if they encounter malformed input.

What is the preferred way to use these functions in a safe way? For
example, if one writes data to a disk using Data.Binary and wants to
read it back in at a later date, how can one ensure that it is valid
so that Data.Binary does not hit an error? Or do you just have to
catch the exception in the IO Monad?


More information about the Haskell-Cafe mailing list