[Haskell-cafe] lazily traversing a foreign data structure

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu Oct 25 15:09:57 EDT 2007


On Oct 25, 2007, at 14:21 , Ryan Ingram wrote:

> On 10/25/07, Brandon S. Allbery KF8NH <allbery at ece.cmu.edu> wrote:
>> I think it might actually be safe in this case:  if the file changes
>> out from under your lazy I/O, far worse things happen in the gdbm
>> library layer than in the unsafe-IO Haskell layer.
>
> Right, but if you do something like
>
> do
>   keys <- getKeysLazy db
>   [.. some computation A here that may or may not evaluate all the  
> keys ..]
>   addRow db newRow
>   [.. some other computation B that uses the key list ..]
>
> does B see the new row or not?

My point is that there's no promise for that one *even in C*.  (The  
equivalent construct being adding the new row before nextKey has  
failed.)

-- 
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