
On Sun, Sep 26, 2010 at 6:13 PM, Antoine Latter
Your new catchSTM can be written from the old one:
newCatchSTM stm h = catchSTM stm (h . fromJust . fromException . toException)
Thanks! Is the toException necessary? It type checks without it.
The following definition for throwSTM typechecks, and does pretty much exactly what you want, but we'll want someone on GHC to let us know that it is not going to do weird things to the RTS:
throwSTM e = STM (raiseIO# (toException e))
Yes, I was playing with this definition to but where a bit afraid of using raiseIO# inside STM.
Attached is a file with the implementations of these and some examples of usage.
Thanks, I will make a patch out of this and attach it to the ticket. We'll see what the GHC devs think of it. Bas