Apache-2.0 licensed by Sergey Vinokurov
Maintained by Sergey Vinokurov
This version can be pinned in stack with:prettyprinter-combinators-0.1.3@sha256:d9a783fd2fc939fd4f9ad4cf41b109778a3b75900cfd535282cc97bce6b77765,2155

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.3

  • Add functions for rendering with specified layout options
  • Add pretty functions for types of enummapset package, could be disabled with enummapset flag
  • Fix build with GHC 9.10

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