[Haskell-cafe] Newbie:Debugging and Overgeneralization

Neil Mitchell ndmitchell at gmail.com
Mon May 15 11:22:55 EDT 2006

Hi Deech,

> 1. Is there a way to output intermediate values of a calculation?
Debug.Trace.trace is what you want, its not quite as convenient (or
safe) as cout, but its usually good enough. If you want to see more
detail then Hat (http://www.haskell.org/hat) is probably what you

> From a general design perspective should I concentrate on
> abstracting away just enough to solve the problem or solve the harder
> problem in the hoping of reusing that code to make life easier in the
> future?
Do what you need to do now, only abstract if it makes this current
problem easier to solve. For example, by separating two phases of an
algorithm, the code might become cleaner and more abstract. In this
case, the code becoming cleaner is the thing to strive for, not more
abstract. If however you know that you will need a function in the
future, you might as well abstract now, but don't do it on the
offchance that it will be useful.



More information about the Haskell-Cafe mailing list