Skip to content

scravy/nicify-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nicify-lib

Build Status

nicify is a tool for pretty printing the default formatting of Show instances. It is especially useful when dumping data during debugging.

Example

Given main.hs:

data X = A [X] | B String | C (X, X)
  deriving (Show)

main = print $
  A [B "one", B "two", A [ C (B "three", B "three prime"), B "woop woop" ]]

you would typically get:

>>> runhaskell main.hs 
A [B "one",B "two",A [C (B "three",B "three prime"),B "woop woop"]]

not so with nicify:

import Text.Nicify

data Z = A [Z] | B String | C (Z, Z)
  deriving (Show)

main = putStrLn . nicify . show
  $ A [B "one", B "two", A [ C (B "three", B "three prime"), B "woop woop" ]]

results in:

>>> runhaskell main.hs -package nicify-lib
A [
    B "one",
    B "two",
    A [
        C (B "three",
        B "three prime"),
        B "woop woop"
    ]
]

nicify is also available as command line tool, see github.com/scravy/nicify

About

Pretty print the standard output of default `Show` instances.

Resources

License

Stars

Watchers

Forks

Packages

No packages published