Difference between errorCalls and userErrors

Donald Bruce Stewart dons at cse.unsw.edu.au
Thu Oct 26 08:51:35 EDT 2006

> Hi!
> In module Control.Exception there are the exception predicates errorCalls
> and userErrors defined. Is there any difference between them? Which one?

They match different kinds of exceptions,
    errorCalls (ErrorCall e) = Just e
    errorCalls _ = Nothing

    assertions (AssertionFailed e) = Just e
    assertions _ = Nothing

    dynExceptions (DynException e) = Just e
    dynExceptions _ = Nothing

    asyncExceptions (AsyncException e) = Just e
    asyncExceptions _ = Nothing

    userErrors (IOException e) | isUserError e = Just (ioeGetErrorString e)
    userErrors _ = Nothing

The 'Awkward Squad' paper should have some details. The various papers
on exceptions should also help (see the 'Research papers' page on the
Haskell wiki).

-- Don

More information about the Glasgow-haskell-users mailing list