debug: Simple trace-based debugger

[ bsd3, debugging, development, library, program ] [ Propose Tags ]

An easy to use debugger for viewing function calls and intermediate variables. To use, annotate the function under test, run the code, and view the generated web page. Full usage instructions are at Debug.

[Skip to Readme]
Versions [faq] 0.0, 0.0.1, 0.0.2, 0.1, 0.1.1
Change log CHANGES.txt
Dependencies base (==4.*), containers, directory, extra, ghc-prim, js-jquery, template-haskell, uniplate [details]
License BSD-3-Clause
Copyright Neil Mitchell 2017
Author Neil Mitchell <>
Maintainer Neil Mitchell <>
Category Development, Debugging
Home page
Bug tracker
Source repo head: git clone
Uploaded by NeilMitchell at Fri Dec 15 13:18:40 UTC 2017
Distributions LTSHaskell:0.1.1, NixOS:0.1.1, Stackage:0.1.1
Downloads 1983 total (110 in the last 30 days)
Rating 2.5 (votes: 3) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2017-12-15 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for debug-0.0

[back to package description]

Shake Hackage version Stackage version Linux Build Status Windows Build Status

Module for debugging Haskell programs. To use, take the functions that you are interested in debugging, e.g.:

module QuickSort(quicksort) where
import Data.List

quicksort :: Ord a => [a] -> [a]
quicksort [] = []
quicksort (x:xs) = quicksort lt ++ [x] ++ quicksort gt
    where (lt, gt) = partition (<= x) xs

Turn on the TemplateHaskell and ViewPatterns extensions, import Debug, indent your code and place it under a call to debug, e.g.:

{-# LANGUAGE TemplateHaskell, ViewPatterns #-}
module QuickSort(quicksort) where
import Data.List
import Debug

debug [d|
   quicksort :: Ord a => [a] -> [a]
   quicksort [] = []
   quicksort (x:xs) = quicksort lt ++ [x] ++ quicksort gt
       where (lt, gt) = partition (<= x) xs

We can now run our debugger with:

$ ghci QuickSort.hs
GHCi, version 8.2.1:  :? for help
[1 of 1] Compiling QuickSort        ( QuickSort.hs, interpreted )
Ok, 1 module loaded.
*QuickSort> quicksort "haskell"
*QuickSort> debugView

The call to debugView starts a web browser to view the recorded information, looking something like:

Debug view output