On Tue, 16 Sep 2003 14:32:48 -0500 "Yu Di" <diyu01@hotmail.com> wrote:
What I am trying to do is to use Haskell to simulate some process, and meanwhile collecting information about the data-flow throughout the whole process into the output. The (String, a) example is just a simplified version of that. Thanks for pointing out my mistakes, I will try to do it as a decorated-data combinator.
Thanks again,
If all you want to do is trace the execution of some computation, you can use the Writer/Output monad. This will associate the outputting with the functions that process the simulation. It looks something like, foo a b = do tell ("Entering foo with "++show a++" "++show b) doStuff a someMoreStuff b tell "Leaving foo" You can write things other than strings.