How can I implement this arrow? Thanks
Derek Elkins
ddarius at hotpop.com
Tue Sep 16 18:53:17 EDT 2003
On Tue, 16 Sep 2003 14:32:48 -0500
"Yu Di" <diyu01 at 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.
More information about the Haskell
mailing list