
Wei Hu wrote:
Thanks for pointing out the sharing part. My original question is still unanswered: for lazy monads, can we give such a general mfix definition?
I think Section 4.1 of http://doi.acm.org/10.1145/351240.351257 has the answer to that. The problem with the proposed general definition is that it computes the fixpoint not only for the values that are manipulated, but also for the involved effects. This doesn't show up for the Identity monad, since there are no effects then, but for more interesting monads the difference should become visible, not only with respect to sharing, but really with respect to the expected outcome of the computation. (Constructing an explicit counterexample is left as an exercise ;-) Ciao, Janis. -- Dr. Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/ mailto:voigt@tcs.inf.tu-dresden.de