Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I ask GHC to import Debug.Trace for every module during development?

The title is pretty self-explanatory. I often add traces when debugging, which requires adding the Debug.Trace import. However, I equally often forget about removing those when I'm done.

What I'd like would be a "dev" switch which would add the import, so that when I disable it I could easily find all of the traces left in the code.

like image 618
Bartek Banachewicz Avatar asked May 19 '16 10:05

Bartek Banachewicz


1 Answers

Why not import trace from an internal .Utils module rather than directly from Debug.Trace, and delete the export of trace from that module when you are done?

It's different, but another expedient I picked up somewhere is to toggle between trace _ = id and import Debug.Trace (trace). Then you can e.g. go back and forth between using (real) trace and doing things like benchmarking, which is of course wrecked by trace. Then when you are done with all that, you can delete the export of (either) trace and hunt down all the remaining evidence that you ever used it in your project...

like image 122
Michael Avatar answered Nov 15 '22 07:11

Michael