
oleg@pobox.com wrote:
If I may interject, that's precisely how a Scheme DB interface is designed. The main function is a left-fold. Not quite though: it provides for a premature termination:
A major procedure: DB1:fold-left PROC INITIAL-SEED QUERY-OBJECT
Premature termination sounds like a useful property. I can see two ways this could be done: keep the previous signature, and use an exception to exit early, or add a boolean return value like the scheme version: doquery :: Process -> String -> (a -> b -> IO (b,Bool)) -> b -> IO b Any opinions on which alternative wouuld be preferable? Tim

Tim Docker writes: | | oleg@pobox.com wrote: | | > If I may interject, that's precisely how a Scheme DB interface is | > designed. The main function is a left-fold. Not quite though: it | > provides for a premature termination: | > | > A major procedure: DB1:fold-left PROC INITIAL-SEED QUERY-OBJECT | | Premature termination sounds like a useful property. I can | see two ways this could be done: keep the previous signature, | and use an exception to exit early, or add a boolean return | value like the scheme version: | | doquery :: Process -> String -> (a -> b -> IO (b,Bool)) -> b -> IO b | | Any opinions on which alternative wouuld be preferable? I don't have a preference, but offer this view of the options: With an exception, "Stop, and return the last b you saw." With a boolean, "Stop, and return this b." By the way, how does the a in a -> b -> IO (b, Bool) work? It looks like it has something to do with the current row. Does doquery have to accommodate any possible substitution for a ? - Tom
participants (2)
-
Tim Docker
-
Tom Pledger