[Haskell-cafe] Annotating calculations

Rene de Visser rene_de_visser at hotmail.com
Wed Jun 15 12:48:45 EDT 2005

>From: Henning Thielemann <lemming at henning-thielemann.de>
>On Wed, 15 Jun 2005, Rene de Visser wrote:
> > I have a somewhat complicated calculation programmed in Haskell.
> > This calculation is coded without using monads.
> > I want to also produce a report describing the details of this 
> > for each particular set of inputs.
> > On the other hand replicating the calculation source code twice, once
> > without reporting and once without seems bad.
>smaller parts. If you have more breaks you have more chances to get
>temporary results. You can put temporary values into a data structure.
>E.g. if you have an iteration don't write a recursion with a fixed abort
>criterion but write a function which maps the old value to the new one,
>then apply 'iterate' on it. Now you can inspect the temporary values and
>you can later apply a function which decides when to stop the iteration.
Thankyou for the reply,
The calculation is for the mostly already structured as you have suggested.
The trouble is there are lots of little pieces that need to be put together.

Do I need to put these pieces together twice? Once to put the whole 
calculation together?
And once to do the reporting? This is what I'd like to avoid.

(A good deal of the complexity comes from that the calculation has a complex 

It would be nice to describe the structure once (at the moment the structure 
of the calculation is describe impliciitly in the Haskell functions) and use 
it both for the calculation and for the reporting.

I thought about using some like Buddha or Hat to generate a data structure 
describing the calculation and mining this for the reporting. But these 
seems like horrible over kill, and probably not very change resistant, not 
to mention making the development not very interactive.


More information about the Haskell-Cafe mailing list