It's probably been asked to death, but would anyone know the least intrusive way to "catch"
catch
:: Exception e
=> IO a
-> (e -> IO a)
-> IO a
error in "pure" haskell computations ?
(say, some code containing head [], not safe, which I do not want to make pure for real, nor force to be monadic)
PS : of course if you can and want to design from scratch, do bake that in (with a maybe type). The question here is that I do knowingly want to keep it unsafe (to keep a simple translation from an unsafe language) and wonder what the nicest/least ugly way to do so.