[Haskell-cafe] unsafeInterleaveIO respecting order of actions

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu Jan 1 19:07:55 EST 2009


On 2009 Jan 1, at 16:44, Henning Thielemann wrote:
> If it is generally possible to use unsafeInterleaveIO such that it
> executes actions in the right order, wouldn't this allow the  
> definition
> of a general lazy IO monad?

I thought unsafeInterleaveIO and users of it (readFile, hGetContents)  
didn't guarantee the order of actions relative to independent IO  
actions (that is, those performed outside the unsafeInterleaveIO) and  
this was why it is generally disrecommended.  For example the  
recurring situation where people try to readFile f >>= writeFile .  
someTransform and the writeFile fails with a "file locked" exception.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list