debug-print: A structured alternative to Show

[ debug, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.0.0, 0.1.0.0, 0.2.0.0, 0.2.0.1
Change log CHANGELOG.md
Dependencies aeson (>=2.1.2.1), base (>=4.17.2.1 && <5), containers (>=0.6.7), debug-print, text (>=2.0.2), vector (>=0.13.1.0) [details]
License MIT
Author
Maintainer Freckle Education
Category Debug
Home page https://github.com/freckle/debug-print#readme
Bug tracker https://github.com/freckle/debug-print/issues
Source repo head: git clone https://github.com/freckle/debug-print
Uploaded by PatrickBrisbin at 2025-04-24T18:19:21Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 36 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2025-05-13 [all 2 reports]

Readme for debug-print-0.2.0.1

[back to package description]

debug-print

Offers ToDebugPrintValue, a structured alternative to Show for printing values for testing and debugging purposes.

import DebugPrint
import DebugPrint.Aeson
import Data.Aeson qualified as Aeson
data Report = Report
  { milliseconds :: Int
  , errors :: [Text]
  , fileName :: Maybe Text
  }
  deriving stock Generic
  deriving anyclass (ToDebugPrintRecord, ToDebugPrintValue)

report :: Report
report = Report{ milliseconds = 5_824
                , errors = ["Warning! Problems."]
                , fileName = Nothing }
main :: IO ()
main = hspec $ do
  it "" $ do
    Aeson.encode (debugPrintValueToAeson report) `shouldBe`
      "{\"errors\":[\"Warning! Problems.\"],\"milliseconds\":5824}"

LICENSE | CHANGELOG