From 9584ebb4395f7f9c904b0a1a7811988a7636c1a8 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 23 Aug 2022 00:36:31 +0100 Subject: [PATCH] imp: lib: Hledger.Utils.Debug: re-export Debug.Breakpoint And add breakpoint as a dependency and enable its GHC plugin in all the hledger packages, so that breakpoint's helpers can be used easily. --- hledger-lib/Hledger/Utils/Debug.hs | 10 +++++++--- hledger-lib/package.yaml | 1 + hledger-ui/package.yaml | 1 + hledger-web/package.yaml | 1 + hledger/package.yaml | 1 + stack.yaml | 4 ++++ stack8.10.yaml | 4 ++++ stack9.0.yaml | 4 ++++ 8 files changed, 23 insertions(+), 3 deletions(-) diff --git a/hledger-lib/Hledger/Utils/Debug.hs b/hledger-lib/Hledger/Utils/Debug.hs index eb6491c4f..5126d4f06 100644 --- a/hledger-lib/Hledger/Utils/Debug.hs +++ b/hledger-lib/Hledger/Utils/Debug.hs @@ -44,6 +44,8 @@ module Hledger.Utils.Debug ( ,pprint' ,pshow ,pshow' + ,useColorOnStdout + ,useColorOnStderr -- * Tracing ,traceWith -- * Pretty tracing @@ -92,9 +94,7 @@ module Hledger.Utils.Debug ( -- ** Trace the state of hledger parsers ,traceParse ,dbgparse - ,module Debug.Trace - ,useColorOnStdout - ,useColorOnStderr + -- ** Debug-logging to a file ,dlogTrace ,dlogTraceAt ,dlogAt @@ -108,6 +108,9 @@ module Hledger.Utils.Debug ( ,dlog7 ,dlog8 ,dlog9 + -- ** Re-exports + ,module Debug.Breakpoint + ,module Debug.Trace ) where @@ -117,6 +120,7 @@ import Control.Monad.IO.Class import Data.List hiding (uncons) import qualified Data.Text as T import qualified Data.Text.Lazy as TL +import Debug.Breakpoint import Debug.Trace import Hledger.Utils.Parse import Safe (readDef) diff --git a/hledger-lib/package.yaml b/hledger-lib/package.yaml index 38a768061..9430b03b6 100644 --- a/hledger-lib/package.yaml +++ b/hledger-lib/package.yaml @@ -38,6 +38,7 @@ dependencies: - ansi-terminal >=0.9 - array - blaze-markup >=0.5.1 +- breakpoint - bytestring - call-stack - cmdargs >=0.10 diff --git a/hledger-ui/package.yaml b/hledger-ui/package.yaml index f2b7cbeef..f2e136af3 100644 --- a/hledger-ui/package.yaml +++ b/hledger-ui/package.yaml @@ -55,6 +55,7 @@ dependencies: - hledger >=1.26.99 && <1.27 - ansi-terminal >=0.9 - async +- breakpoint - cmdargs >=0.8 - containers >=0.5.9 - data-default diff --git a/hledger-web/package.yaml b/hledger-web/package.yaml index fb0c0b68b..b95ba3762 100644 --- a/hledger-web/package.yaml +++ b/hledger-web/package.yaml @@ -106,6 +106,7 @@ library: - base64 - blaze-html - blaze-markup + - breakpoint - bytestring - case-insensitive - clientsession diff --git a/hledger/package.yaml b/hledger/package.yaml index 0eba2e6f8..798cb1e35 100644 --- a/hledger/package.yaml +++ b/hledger/package.yaml @@ -101,6 +101,7 @@ dependencies: - hledger-lib >=1.26.99 && <1.27 - aeson >=1 - ansi-terminal >=0.9 +- breakpoint - bytestring - cmdargs >=0.10 - containers >=0.5.9 diff --git a/stack.yaml b/stack.yaml index 595c808ca..30d5e95aa 100644 --- a/stack.yaml +++ b/stack.yaml @@ -10,6 +10,7 @@ packages: extra-deps: # for hledger-lib: +- breakpoint-0.1.0.0 # for hledger: # for hledger-ui: - brick-1.0 @@ -20,6 +21,9 @@ nix: pure: false packages: [perl gmp ncurses zlib] +ghc-options: + "$locals": -fplugin Debug.Breakpoint + # # for precise profiling, per https://www.tweag.io/posts/2020-01-30-haskell-profiling.html: # # apply-ghc-options: everything # # rebuild-ghc-options: true diff --git a/stack8.10.yaml b/stack8.10.yaml index 5f1eb93b0..79793e977 100644 --- a/stack8.10.yaml +++ b/stack8.10.yaml @@ -14,6 +14,7 @@ packages: extra-deps: # for hledger-lib: +- breakpoint-0.1.0.0 - doctest-0.20.0 # for hledger: # for hledger-ui: @@ -24,6 +25,9 @@ extra-deps: # for hledger-web: # for Shake.hs: +ghc-options: + "$locals": -fplugin Debug.Breakpoint + # for precise profiling, per https://www.tweag.io/posts/2020-01-30-haskell-profiling.html: # apply-ghc-options: everything # rebuild-ghc-options: true diff --git a/stack9.0.yaml b/stack9.0.yaml index 2674a0d87..9af032a4d 100644 --- a/stack9.0.yaml +++ b/stack9.0.yaml @@ -18,6 +18,7 @@ packages: extra-deps: # for hledger-lib: +- breakpoint-0.1.0.0 # for hledger: # for hledger-ui: - brick-1.0 @@ -27,6 +28,9 @@ extra-deps: # for hledger-web: # for Shake.hs: +ghc-options: + "$locals": -fplugin Debug.Breakpoint + # for precise profiling, per https://www.tweag.io/posts/2020-01-30-haskell-profiling.html: # apply-ghc-options: everything # rebuild-ghc-options: true