Proposal: Add throwSTM and generalize catchSTM
Bas van Dijk
v.dijk.bas at gmail.com
Mon Oct 18 16:23:51 EDT 2010
On Sun, Sep 26, 2010 at 5:24 PM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> Dear all,
> Currently the only way to throw an exception in an STM transaction is
> via throw. The IO monad has the throwIO function which guarantees
> ordering with respect to other IO actions. It would be nice to have a
> similar function for the STM monad:
> throwSTM :: Exception e => e -> STM a
> I propose adding this to Control.Monad.STM.
> Additionally I propose to generalize:
> catchSTM :: STM a -> (SomeException -> STM a) -> STM a
> catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a
> to make it consistent with the IO catch function:
> catch :: Exception e => IO a -> e -> IO a -> IO a
> and allow packages like exception-monads-fd/tf to define an instance
> MonadException STM.
> I don't have a patch because I think these changes also require
> modifying/extending the rts which I don't feel comfortable with doing
> right now.
> Discussion deadline: Three weeks, until Sunday 17th October (because of ICFP).
> Ticket: http://hackage.haskell.org/trac/ghc/ticket/4343
The deadline for this proposal has passed.
There were no -1 and three +1s, so I'm setting the status of the
ticket to 'patch':
Do I also have to close the ticket as the Library Submissions
Procedure specifies, or should that be done when the patch is actually
More information about the Libraries