[Haskell-cafe] TVars & throw

Thomas Conway drtomc at gmail.com
Wed Mar 7 20:25:15 EST 2007

Hi All,

Consider the following:

foo = do
    v <- newTVar "hi there!"
    throwDyn v

main = do
    catchDyn (atomically foo) \v -> do
        x <- atomically (readTVar v)
        putStr x

I.e. throw information that gets rolled back from inside a
transaction, catch it and use it.

This looks like bad. I assume it actually works, but should it?

Dr Thomas Conway      You are beautiful; but learn to work,
drtomc at gmail.com         for you cannot eat your beauty.
                                              -- Congo proverb

More information about the Haskell-Cafe mailing list