[Haskell-beginners] Partial Loading and Debugging with GHCI

Alexander Dunlap alexander.dunlap at gmail.com
Fri Apr 17 01:21:20 EDT 2009


On Thu, Apr 16, 2009 at 8:34 PM, Edward Z. Yang <ezyang at mit.edu> wrote:
> On Thu, 16 Apr 2009, aditya siram wrote:
>>
>> I'm curious as to how one would go about debugging the following program:
>
> Alternatively, instead of trying to find out what the type is (which
> might something completely unintelligible and unhelpful, due to
> Haskell's type inferencing), use :: liberally on subexpressions to say
> "I think the type here should be *blah*"; it will let you zoom in on the
> compiler-human mismatch much more quickly. I think this is one of the
> best ways of Haskell debugging.
>
> Cheers,
> Edward
> _______________________________________________

I use this technique a lot. By telling the compiler more and more
about what you think out to be going on, you can ascertain much more
quickly where you disagree with the compiler.

Alex


More information about the Beginners mailing list