ChrisK wrote:
The data dependency is circular.
Yes and no. The input and outputs pairs are dependent on each other, but
the integer doesn't depend on the string. Thus, I'm pretty sure that
(Int, String) -> (Int, String)
can be refactored into
Int -> (Int, String -> String)
This is related to attribute grammars, I finally found the reference
Designing and Implementing Combinator Languages.
S. Doaitse Swierstra, Pablo R. Azero Alcocer, João Saraiva
http://people.cs.uu.nl/doaitse/Papers/1999/AFP3.pdf
I'd even add after to the result of the functions in order to avoid
the O(n^2) degenerate case.
In any case, I prefer Wadler's combinators. With line being more rigid
than Brk , nest and group basically factor the monolithic Blk
which makes more laws and available and hence gives a more elegant
implementation.
Regards,
apfelmus
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe