Proposal: Add throwSTM and generalize catchSTM
Maciej Piechotka
uzytkownik2 at gmail.com
Sun Sep 26 16:09:48 EDT 2010
On Sun, 2010-09-26 at 15:46 -0400, Simon Marlow wrote:
> On 26/09/10 13:55, Bas van Dijk wrote:
> > On Sun, Sep 26, 2010 at 6:13 PM, Antoine Latter<aslatter at gmail.com> wrote:
> >> Your new catchSTM can be written from the old one:
> >>
> >>> newCatchSTM stm h = catchSTM stm (h . fromJust . fromException . toException)
>
> Agree in principle, but I don't think that implementation works, does
> it? If the exception is the wrong type, fromJust will throw an error,
> whereas you want to just re-throw the original exception.
>
> > I will make a patch out of this and attach it to the ticket. We'll see
> > what the GHC devs think of it.
>
> Fine by me.
>
> Cheers,
> Simon
newCatchSTM stm h
= catchSTM stm (\e -> maybe (throwSTM e) f $ fromException e)
Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/libraries/attachments/20100926/7cd4e04d/attachment.bin
More information about the Libraries
mailing list