David Fox wrote:
Here is a practical example I ran into a few days ago. With this expression:

   writeFile path (compute text)

the file at path would be overwritten with an empty file if an error occurs while evaluating (compute text). With this one:

  writeFile path $! (compute text)

the file alone when an error occurs.

If I understand you correctly, that would be because compute text is capable of throwing an exception.

That, then, is the danger of using exceptions in pure code.

Personally I'd use an error-signalling type (like Either) and then this wouldn't be an issue.

Jules
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to