
31 Jan
2011
31 Jan
'11
9:17 a.m.
There is a common idiom used in Control.Concurrent libraries, as embodied in the implementation of bracket: http://www.haskell.org/ghc/docs/7.0-latest/html/libraries/base-4.3.0.0/src/C... bracket before after thing = mask $ \restore -> do a <- before r <- restore (thing a) `onException` after a _ <- after a return r Is there any particular reason why bracket is not implemented as: bracket before after thing = mask $ \restore -> do a <- before r <- restore (thing a) `finally` after a return r Is there some subtle semantic difference? Is there a performance difference? It seems like a trivial thing, but I am genuinely curious. Best, Leon