Skip to content

A structured alternative to Show for printing values for testing and debugging purposes.

License

Notifications You must be signed in to change notification settings

freckle/debug-print

Repository files navigation

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]
  }
  deriving stock Generic
  deriving anyclass (ToDebugPrintRecord, ToDebugPrintValue)

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

LICENSE | CHANGELOG

About

A structured alternative to Show for printing values for testing and debugging purposes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published