[ bsd3, debugging, program ] [ Propose Tags ]

A preprocessor to automate the debug instrumentation of a module

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS], 0.1.1
Dependencies base (>=4.7 && <5) [details]
License BSD-3-Clause
Copyright All Rights Reserved
Author Pepe Iborra
Category Debugging
Home page
Uploaded by PepeIborra at 2017-12-29T17:38:51Z
Reverse Dependencies 1 direct, 0 indirect [details]
Executables debug-pp
Downloads 1352 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2017-12-29 [all 3 reports]

Readme for debug-pp-

[back to package description]

Travis Build Status Hackage Stackage Nightly


A preprocessor for streamlining the debug instrumentation of a module or a package.


debug-pp is a Haskell source preprocessor that performs the steps a programmer would need to follow in order to debug a module with the debug package. That is:

  • append an import for the Debug module, and
  • wrap the body in a debug splice using a TH declaration quasiquote.


usage: debug-pp [FILENAME] [SOURCE] [DEST]
Instrument Haskell module for debugging from SOURCE (derived from FILENAME) and write
standard Haskell to DEST.
If no FILENAME, use SOURCE as the original name.
If no DEST or if DEST is `-', write to standard output.
If no SOURCE or if SOURCE is `-', read standard input.

To instrument a module, add the following pragma to the top of the file:

{-# OPTIONS -F -pgmF debug-pp #-}

To instrument an entire program, add the following line to your stack descriptor, or if you don't use stack, to your cabal descriptor:

ghc-options: -F -pgmF debug-pp

In both cases you will also need to modify your Cabal descriptor in order to:

  • add a dependency on the debug package, and
  • add a build tool depends on debug-pp (required Cabal 2.0) :
  build-tool-depends: debug-pp:debug-pp


  • Debugging individual functions is often impractical due to the declaration groups restriction of Template Haskell. Therefore, it's often easier to debug an entire module.

  • However, error messages are much worse for TH quoted code. Errors like Not in scope: data constructor Foo in line X become Not in scope: Foo, in the TH quotation ENTIRE MODULE HERE.

  • Personally, quoting/unquoting the module by hand is annoying. Having a preprocessor do this for me is convenient, and can be easily tied to a Cabal flag ora stack command line arg.