Popularity
5.0
Declining
Activity
0.0
Stable
8
2
2

Monthly Downloads: 10
Programming language: Haskell
License: MIT License
Tags: Text    

generic-pretty alternatives and similar packages

Based on the "Text" category.
Alternatively, view generic-pretty alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of generic-pretty or a related project?

Add another 'Text' Package

README

generic-pretty

Pretty printing for Generic data

Usage

Define your data types and derives Generic. Then you can make instances for pretty printing automatically.

data Foo = Foo { fooA :: Int, fooB :: String } deriving Generic
instance Pretty Foo

data Bar a = Bar { barA :: Foo, barB :: a } deriving Generic
instance Pretty a => Pretty (Bar a)

Now, you can pretty print your value.

> prettyPrint $ Foo 123 "foo"
Foo { fooA = 123, fooB = "foo" }

> prettyPrint $ Bar (Foo 123 "foo") (Just True)
Bar { barA = Foo { fooA = 123
                 , fooB = "foo" }
    , barB = Just True }

By default, generic-pretty prints highlighted values. If you do not want this behavior, you can use plain version of pretty printer.

highligthed