How to best add logging/debugging code?

ketil+haskell at ii.uib.no ketil+haskell at ii.uib.no
Sun Nov 16 20:21:10 EST 2003


Ben Escoto <bescoto at stanford.edu> writes:

> Hi all, does anyone have any tips on how to insert debugging or
> logging statements through a program?

> 1.  Use some kind of logging monad.

> 2.  Use unsafePerformIO or similar.

> It seems this must come up a lot when writing Haskell programs.  What
> do most pople do?

The latter.  In my case, it's more for debugging than logging,
so I can live with somewhat weak guarantees.

If you need to do it more properly, the simple solution might be to
limit logging to when you're in the IO monad anyway?

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell mailing list