On 29 March 2006 11:00, Ross Paterson wrote: > On Tue, Mar 28, 2006 at 10:25:04AM +0100, Simon Marlow wrote: >> On 28 March 2006 00:24, Ross Paterson wrote: >>> How about STM (minus retry/orElse) and TVars as the portable >>> interface? They're trivial for a single-threaded implementation, and >>> provide a comfortable interface for everyone. >> >> It just occurred to me that STM isn't completely trivial in a >> single-threaded implementation, because exceptions have to abort a >> transaction in progress. > > Almost trivial, though: > > import Prelude hiding (catch) > import Control.Exception > import Data.IORef > > -- The reference contains a rollback action to be executed on > newtype STM a = STM (IORef (IO ()) -> IO a)
very clever ;-) Simon _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime