Skip to content

Instantly share code, notes, and snippets.

@danidiaz
Created February 3, 2014 22:59
Show Gist options
  • Select an option

  • Save danidiaz/8794173 to your computer and use it in GitHub Desktop.

Select an option

Save danidiaz/8794173 to your computer and use it in GitHub Desktop.
defining a custom exception
{-# 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