
Hi Samuel:
You are correct that the lazy construction of the tuple is crucial in
tying-the-monadic-knot. However, the point about making the BTree
constructors strict is still interesting, as it pertains to delayed use of
recursive values, rather than how they are represented/stored. The
situation is really no different than a regular recursive let-expression in
a non-monadic context.
Of course, it would still be fine to update the text to make that point
clear like you suggested, should you be so inclined!
-Levent.
On Sun, Oct 18, 2015 at 7:40 AM, Samuel Rødal
Hello,
the MonadFix wiki at https://wiki.haskell.org/MonadFix has a statement that I feel is a bit misleading.
In section "2.2 Lazy algorithm interleaved with effects", it claims that making the BTree data structure strict doesn't cause endless recursion.
Well, that's true, but that's just because rep_x_sum returns a tuple containing the BTree and the summed values of the current subtree, and the tuple is lazily constructed - postponing the construction of the tree value. So highlighting the fact that the function still works when the BTree structure is made strict is kind of a red herring.
Maybe the confusion could be avoided by removing the part about making BTree strict, or adding a note about the tuple still ensuring lazy construction?
-- Samuel _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe