[Haskell-cafe] lazily traversing a foreign data structure
Graham Fawcett
graham.fawcett at gmail.com
Thu Oct 25 15:34:09 EDT 2007
On 10/25/07, Brandon S. Allbery KF8NH <allbery at ece.cmu.edu> wrote:
> On Oct 25, 2007, at 14:21 , Ryan Ingram wrote:
> > 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.)
Just so. Deletions, for example, may change the ordering of the
internal hashtable (according to the gdbm manpage), making some keys
unfindable by a series of nextKey calls.
(If I were writing a serious module, and not just noodling around, I
imagine I'd document this, and let the user decide whether strict
evaluation was required.)
Thanks again to all,
Graham
More information about the Haskell-Cafe
mailing list