[Haskell-cafe] Newbie:Debugging and Overgeneralization
Aditya Siram
aditya_siram at hotmail.com
Mon May 15 11:14:27 EDT 2006
I have been working with a Haskell text for the past couple of months or so
and I have some general problem solving questions.
1. Is there a way to output intermediate values of a calculation? As an
imperative programmer I have become used to using "System.out"'s or 'cout's
to check that my function works as intended. I can see no easy way to do
that in Haskell. The only solution I could come up with was to avoid using
nested functions except for the most trivial expressions and test all
expressions in the interpreter. This approach seems to make my code ugly and
less readable.
2. Haskell is great because it makes abstracting from problem very easy. For
example, if the problem asks for the area of a square, why not write a
function to compute the area of all polygons? find myself falling into the
trap of generalizing to the point that a simple problem becomes quite a bit
harder . 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?
Thanks....
Deech
More information about the Haskell-Cafe
mailing list