[Haskell-cafe] Real World Haskell Chapter 19 and GHC 6.10

Michael Mossey mpm at alumni.caltech.edu
Thu Oct 22 01:21:12 EDT 2009


Apparently the old exception library had convenience functions like 
'arithExceptions' that could be used with 'handleJust'.

handleJust arithExceptions handler thing

With the new module you can write something like this (I determined this 
from experimentation):

arithExceptionTester :: ArithException -> IO ()
arithExceptionTester = Just ()

handleJust arithExceptionTester handler thing


Two questions:

(1) Is there a better way to do things?

(2) I don't understand quite how the type system works. Somehow, on 
exceptions that aren't arithmetic, arithExceptionTester returns Nothing or 
at least behaves that way. Yet I didn't write any code to do that. Can 
someone explain this?

Thanks,
Mike


More information about the Haskell-Cafe mailing list