https://github.com/freckle/debug-print
A structured alternative to Show for printing values for testing and debugging purposes.
https://github.com/freckle/debug-print
ghvm-managed
Last synced: about 1 year ago
JSON representation
A structured alternative to Show for printing values for testing and debugging purposes.
- Host: GitHub
- URL: https://github.com/freckle/debug-print
- Owner: freckle
- License: mit
- Created: 2025-02-25T18:49:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-28T00:33:28.000Z (about 1 year ago)
- Last Synced: 2025-05-28T13:03:42.951Z (about 1 year ago)
- Topics: ghvm-managed
- Language: Haskell
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.lhs
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# debug-print
Offers `ToDebugPrintValue`, a structured alternative to `Show`
for printing values for testing and debugging purposes.
```haskell
import DebugPrint
import DebugPrint.Aeson
import Data.Aeson qualified as Aeson
```
```haskell
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 }
```
```haskell
main :: IO ()
main = hspec $ do
it "" $ do
Aeson.encode (debugPrintValueToAeson report) `shouldBe`
"{\"errors\":[\"Warning! Problems.\"],\"milliseconds\":5824}"
```
---
[LICENSE](./LICENSE) | [CHANGELOG](./CHANGELOG.md)