Re: [Haskell-cafe] Where is the documentation on exception types kept?

2012-11-07 Thread Albert Y. C. Lai

On 12-11-07 03:36 PM, timothyho...@seznam.cz wrote:

I am trying to catch an thread blocked on MVar indefinitely
exception.  Of course I can use ::SomeException as explained in
http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Exception.html#g:3
but there is no explanation as to how to find the more case specific
exceptions.


In general, because Exception instances are Typeable instances, you can 
get a name, and then you can use that for searches.


import Control.Exception
import Data.Typeable

main = do
  aida - try (readFile no)
  case aida of
Left (SomeException e) - print (typeOf e)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Where is the documentation on exception types kept?

2012-11-07 Thread timothyhobbs
Thanks!  That is a neat way.  At least for exceptions which I know to exists
and know how to trigger ;)

Tim


-- Původní zpráva --
Od: Albert Y. C. Lai tre...@vex.net
Datum: 7. 11. 2012
Předmět: Re: [Haskell-cafe] Where is the documentation on exception types 
kept?
On 12-11-07 03:36 PM, timothyho...@seznam.cz wrote:
 I am trying to catch an thread blocked on MVar indefinitely
 exception. Of course I can use ::SomeException as explained in
 http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-
Exception.html#g:3
(http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Exception.html#g:3)
 but there is no explanation as to how to find the more case specific
 exceptions.

In general, because Exception instances are Typeable instances, you can 
get a name, and then you can use that for searches.

import Control.Exception
import Data.Typeable

main = do
aida - try (readFile no)
case aida of
Left (SomeException e) - print (typeOf e)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
(http://www.haskell.org/mailman/listinfo/haskell-cafe)___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe