[Haskell-cafe] Re: Knot tying vs monads
apfelmus at quantentunnel.de
Tue Nov 20 09:49:42 EST 2007
> 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
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
More information about the Haskell-Cafe