Commit 3222b7ae authored by Michael Snoyman's avatar Michael Snoyman Committed by Herbert Valerio Riedel
Browse files

Add displayException method to Exception (#9822)

Defaults to using `show` to prevent any breakage of existing code.  Also
provide a custom implementation for `SomeException` which uses the
underlying exception's `displayException`.

Differential Revision: https://phabricator.haskell.org/D517
parent e16a342d
......@@ -140,9 +140,18 @@ class (Typeable e, Show e) => Exception e where
toException = SomeException
fromException (SomeException e) = cast e
-- | Render this exception value in a human-friendly manner.
--
-- Default implementation: @'show'@.
--
-- /Since: 4.8.0.0/
displayException :: e -> String
displayException = show
instance Exception SomeException where
toException se = se
fromException = Just
displayException (SomeException e) = displayException e
-- | Throw an exception. Exceptions may be thrown from purely
-- functional code, but may only be caught within the 'IO' monad.
......
......@@ -104,6 +104,8 @@
* Add `fillBytes` to `Foreign.Marshal.Utils`.
* Add new `displayException` method to `Exception` typeclass. (#9822)
## 4.7.0.1 *Jul 2014*
* Bundled with GHC 7.8.3
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment