Apache-2.0 licensed by Sergey Vinokurov
Maintained by Sergey Vinokurov
This version can be pinned in stack with:prettyprinter-combinators-0.1.2@sha256:5b725a01c109472acabe8623159805db502a3248770848373706d311406feb50,1898

build

This is a set of utilities for the Haskell prettyrinter package. Most notable is automatic deriving of Pretty instance from the Generic instance, e.g.

{-# LANGUAGE DeriveGeneric #-}

import Prettyprinter.Generics

data Foo a b = Bar Int | Baz a b
  deriving (Generic)

instance (Pretty a, Pretty b) => Pretty (Foo a b) where
  pretty = ppGeneric

printed :: Doc ann
printed = pretty $ Baz (Bar 10 :: Foo () ()) [1..22]

which would put following into printed:

Baz
  Bar 10
  [ 1
  , 2
  , 3
  , 4
  , 5
  , 6
  , 7
  , 8
  , 9
  , 10
  , 11
  , 12
  , 13
  , 14
  , 15
  , 16
  , 17
  , 18
  , 19
  , 20
  , 21
  , 22 ]

Changes

0.1.2

  • Fix build with GHC 9.8
  • Add PPGeneric newtype to apply ppGeneric through DerivingVia
  • Add PPShow newtype to apply ppShow through DerivingVia

0.1.1.1

  • ppVector and ppVectorWith now accept generic vectors
  • Add lower bound pretty-show >= 1.6