Created
February 15, 2013 01:05
-
-
Save tmhedberg/4957861 to your computer and use it in GitHub Desktop.
Template Haskell macro for producing less repetitive debugging statements. Requires the `th-orphans` package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE TemplateHaskell #-} | |
| module NiceDebug where | |
| import Debug.Trace | |
| import Language.Haskell.TH | |
| import Language.Haskell.TH.Instances | |
| debug :: Name -> Q Exp | |
| debug name = [|trace $ nameBase name ++ ": " ++ show $(varE name)|] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment