Created
February 3, 2014 22:59
-
-
Save danidiaz/8794173 to your computer and use it in GitHub Desktop.
defining a custom exception
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE DeriveDataTypeable #-} | |
| data HiddenException e = HiddenException e | |
| deriving (Show, Typeable) | |
| instance (Show e, Typeable e) => Exception (HiddenException e) | |
| elideError :: (Show e, Typeable e) => ErrorT e IO a -> IO a | |
| elideError action = do | |
| runErrorT action >>= either (throwIO.HiddenException) return | |
| -- Pipe ByteString ByteString IO X |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment