wiki:ImpreciseExceptions

Version 4 (modified by simonmar@…, 8 years ago) (diff)

--

Imprecise Exceptions

Ticket: #39

See ExtensionDescriptionHowto for information on how to write these extension descriptions. Please add any new extensions to the list of HaskellExtensions.

Brief Explanation

In Haskell 98, exceptions may be caught and thrown only in the IO monad. The error function generates failures from pure code, but cannot be caught.

Imprecise exceptions may be thrown by pure code and caught in the IO monad. IO exceptions and error are subsumed as special cases.

References

Pros

  • more robust programs
  • implemented by GHC and Hugs for several years

Cons

  • complicates denotational semantics a little
  • very tricky to implement properly
  • requires non-trivial run-time support and implementation constraints