[Haskell-cafe] Annotating calculations

Rene de Visser rene_de_visser at hotmail.com
Wed Jun 15 11:50:36 EDT 2005


Hello,

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 calculation 
for each particular set of inputs.
e.g. Number of hours worked = 100. Gross pay per hour = 50. Total gross = 
100 * 50 = 500.
etc.
But about 20 times more complicated than the above.

Naturally I need to write functions to produce the above description/report 
as it should be well presented. Only showing the important parts of the 
calculation in a sensible order.

But I am wondering how to combine the generation of the report with the 
calculation together.

I think if I add the report generating functions into the calculation 
functions, it will make them twice as messy, and they are already 
complicated enough.

On the other hand replicating the calculation source code twice, once 
without reporting and once without seems bad.

Any suggestions on how to handle this?

Rene.




More information about the Haskell-Cafe mailing list