[Haskell-cafe] Throwing and catching exceptions in STM
Bas van Dijk
v.dijk.bas at gmail.com
Fri Sep 24 16:21:19 EDT 2010
Hello,
The IO monad has the following function for throwing an exception:
throwIO :: Exception e => e -> IO a
Is there an analogous way of throwing an exception in the STM monad?
I can try using: throw :: Exception e => e -> a.
But does this guarantee ordering with respect to other STM actions?
The IO monad has the following function for catching exceptions:
catch :: Exception e => IO a -> (e -> IO a) -> IO a
Why is catchSTM defined as:
catchSTM :: STM a -> (SomeException -> STM a) -> STM a
And not as the more general and more consistent:
catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a
Thanks,
Bas
More information about the Haskell-Cafe
mailing list