[Haskell-cafe] Re: IO exception not being caught

Joel Reymont joelr1 at gmail.com
Wed Nov 16 10:37:25 EST 2005


After almost two months with Haskell I'm starting to understand why  
its use is not as widespread as... well pick a favorite language of  
your own. My issue was that of indentation.

Compare this working version:

liftIOTrap io =
     do mx <- liftIO (do x <- io
                         return (return x)
                      `catchError`
                      (\e -> do let x = fromIOError e
                                trace_ $ "Caught " ++ x
                                return $ throwError x
                      ))
        mx

With the one below

On Nov 16, 2005, at 2:27 PM, Joel Reymont wrote:

>> liftIOTrap io =
>>     do mx <- liftIO (do x <- io
>>                         return (return x)
>>                                    `catchError`
>>                                    (\e -> return (throwError
>>                                                   (fromIOError e))))
>>        mx

--
http://wagerlabs.com/







More information about the Haskell-Cafe mailing list