[Haskell-cafe] Debugging

Monang Setyawan monang at gmail.com
Sat May 5 02:15:50 EDT 2007


On 5/5/07, Stefan O'Rear <stefanor at cox.net> wrote:
> On Fri, May 04, 2007 at 10:44:15PM -0700, Ryan Dickie wrote:
> > I've only written trivial applications and functions in haskell. But the
> > title of this thread got me thinking.
> >
> > In an imperative language you have clear steps, states, variables to watch,
> > etc.
> > What techniques/strategies might one use for a functional language?
>
> I personally most often use a divide-and-conquer approach.  I pick a
> point about halfway down the call stack, and add trace calls.  If the
> subproblems are handled correctly, narrow scope to higher levels;
> otherwise narrow to lower levels.  Repeat until you have a single
> misbehaving function.

Isn't that called binary search, instead of divide-and-conquer?

BTW, how about adding assertion in Haskell? Can it be done?
(I've searched in my GHC 6.4.2 library documentation, and can't find 'assert')

Is there any way to automatically clean all the mess I've done in
debugging/asserting (like removing all trace/assert expressions) when
I compile Haskell source code? Or should I create a simple program to
remove them?

>
> Stefan
>


-- 
Demi masa..


More information about the Haskell-Cafe mailing list