news

MonadCatchIO-mtl, a monad-transformer version of the Control.Exception.catch function is now available for Fedora. Install it using:

$ sudo yum install ghc-MonadCatchIO-mtl ghc-MonadCatchIO-mtl-devel

A simple example to throw or catch an exception that is an instance of the Exception class:

{-# LANGUAGE DeriveDataTypeable #-}

import Control.Monad.CatchIO
import Data.Typeable
import Prelude hiding (catch)

data MyException = ThisException | ThatException
     deriving (Show, Typeable)

instance Exception MyException

main = do
     throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException))

Thanks to Daniel GorĂ­n for the upstream changes.