#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif

-----------------------------------------------------------------------------
-- |
-- Module      :  Text.PrettyPrint.Annotated.HughesPJClass
-- Copyright   :  (c) Trevor Elliott <revor@galois.com> 2015
-- License     :  BSD-style (see the file LICENSE)
--
-- Maintainer  :  David Terei <code@davidterei.com>
-- Stability   :  stable
-- Portability :  portable
--
-- Pretty printing class, simlar to 'Show' but nicer looking.
--
-- Note that the precedence level is a 'Rational' so there is an unlimited
-- number of levels. This module re-exports
-- 'Text.PrettyPrint.Annotated.HughesPJ'.
--
-----------------------------------------------------------------------------

module Text.PrettyPrint.Annotated.HughesPJClass (
    -- * Pretty typeclass
    Pretty(..),

    PrettyLevel(..), prettyNormal,
    prettyShow, prettyParen,

    -- re-export HughesPJ
    module Text.PrettyPrint.Annotated.HughesPJ
  ) where

import Text.PrettyPrint.Annotated.HughesPJ

-- | Level of detail in the pretty printed output. Level 0 is the least
-- detail.
newtype PrettyLevel = PrettyLevel Int
  deriving (PrettyLevel -> PrettyLevel -> Bool
(PrettyLevel -> PrettyLevel -> Bool)
-> (PrettyLevel -> PrettyLevel -> Bool) -> Eq PrettyLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PrettyLevel -> PrettyLevel -> Bool
== :: PrettyLevel -> PrettyLevel -> Bool
$c/= :: PrettyLevel -> PrettyLevel -> Bool
/= :: PrettyLevel -> PrettyLevel -> Bool
Eq, Eq PrettyLevel
Eq PrettyLevel =>
(PrettyLevel -> PrettyLevel -> Ordering)
-> (PrettyLevel -> PrettyLevel -> Bool)
-> (PrettyLevel -> PrettyLevel -> Bool)
-> (PrettyLevel -> PrettyLevel -> Bool)
-> (PrettyLevel -> PrettyLevel -> Bool)
-> (PrettyLevel -> PrettyLevel -> PrettyLevel)
-> (PrettyLevel -> PrettyLevel -> PrettyLevel)
-> Ord PrettyLevel
PrettyLevel -> PrettyLevel -> Bool
PrettyLevel -> PrettyLevel -> Ordering
PrettyLevel -> PrettyLevel -> PrettyLevel
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: PrettyLevel -> PrettyLevel -> Ordering
compare :: PrettyLevel -> PrettyLevel -> Ordering
$c< :: PrettyLevel -> PrettyLevel -> Bool
< :: PrettyLevel -> PrettyLevel -> Bool
$c<= :: PrettyLevel -> PrettyLevel -> Bool
<= :: PrettyLevel -> PrettyLevel -> Bool
$c> :: PrettyLevel -> PrettyLevel -> Bool
> :: PrettyLevel -> PrettyLevel -> Bool
$c>= :: PrettyLevel -> PrettyLevel -> Bool
>= :: PrettyLevel -> PrettyLevel -> Bool
$cmax :: PrettyLevel -> PrettyLevel -> PrettyLevel
max :: PrettyLevel -> PrettyLevel -> PrettyLevel
$cmin :: PrettyLevel -> PrettyLevel -> PrettyLevel
min :: PrettyLevel -> PrettyLevel -> PrettyLevel
Ord, Int -> PrettyLevel -> ShowS
[PrettyLevel] -> ShowS
PrettyLevel -> String
(Int -> PrettyLevel -> ShowS)
-> (PrettyLevel -> String)
-> ([PrettyLevel] -> ShowS)
-> Show PrettyLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PrettyLevel -> ShowS
showsPrec :: Int -> PrettyLevel -> ShowS
$cshow :: PrettyLevel -> String
show :: PrettyLevel -> String
$cshowList :: [PrettyLevel] -> ShowS
showList :: [PrettyLevel] -> ShowS
Show)

-- | The "normal" (Level 0) of detail.
prettyNormal :: PrettyLevel
prettyNormal :: PrettyLevel
prettyNormal = Int -> PrettyLevel
PrettyLevel Int
0

-- | Pretty printing class. The precedence level is used in a similar way as in
-- the 'Show' class. Minimal complete definition is either 'pPrintPrec' or
-- 'pPrint'.
class Pretty a where
  pPrintPrec :: PrettyLevel -> Rational -> a -> Doc ann
  pPrintPrec PrettyLevel
_ Rational
_ = a -> Doc ann
forall ann. a -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pPrint

  pPrint :: a -> Doc ann
  pPrint = PrettyLevel -> Rational -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> Rational -> a -> Doc ann
forall ann. PrettyLevel -> Rational -> a -> Doc ann
pPrintPrec PrettyLevel
prettyNormal Rational
0

  pPrintList :: PrettyLevel -> [a] -> Doc ann
  pPrintList PrettyLevel
l = Doc ann -> Doc ann
forall a. Doc a -> Doc a
brackets (Doc ann -> Doc ann) -> ([a] -> Doc ann) -> [a] -> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Doc ann] -> Doc ann
forall a. [Doc a] -> Doc a
fsep ([Doc ann] -> Doc ann) -> ([a] -> [Doc ann]) -> [a] -> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc ann -> [Doc ann] -> [Doc ann]
forall a. Doc a -> [Doc a] -> [Doc a]
punctuate Doc ann
forall a. Doc a
comma ([Doc ann] -> [Doc ann]) -> ([a] -> [Doc ann]) -> [a] -> [Doc ann]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Doc ann) -> [a] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
map (PrettyLevel -> Rational -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> Rational -> a -> Doc ann
forall ann. PrettyLevel -> Rational -> a -> Doc ann
pPrintPrec PrettyLevel
l Rational
0)

#if __GLASGOW_HASKELL__ >= 708
  {-# MINIMAL pPrintPrec | pPrint #-}
#endif

-- | Pretty print a value with the 'prettyNormal' level.
prettyShow :: (Pretty a) => a -> String
prettyShow :: forall a. Pretty a => a -> String
prettyShow = Doc Any -> String
forall a. Doc a -> String
render (Doc Any -> String) -> (a -> Doc Any) -> a -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Doc Any
forall ann. a -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pPrint

pPrint0 :: (Pretty a) => PrettyLevel -> a -> Doc ann
pPrint0 :: forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l = PrettyLevel -> Rational -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> Rational -> a -> Doc ann
forall ann. PrettyLevel -> Rational -> a -> Doc ann
pPrintPrec PrettyLevel
l Rational
0

appPrec :: Rational
appPrec :: Rational
appPrec = Rational
10

-- | Parenthesize an value if the boolean is true.
{-# DEPRECATED prettyParen "Please use 'maybeParens' instead" #-}
prettyParen :: Bool -> Doc ann -> Doc ann
prettyParen :: forall ann. Bool -> Doc ann -> Doc ann
prettyParen = Bool -> Doc ann -> Doc ann
forall ann. Bool -> Doc ann -> Doc ann
maybeParens

-- Various Pretty instances
instance Pretty Int where pPrint :: forall ann. Int -> Doc ann
pPrint = Int -> Doc ann
forall ann. Int -> Doc ann
int

instance Pretty Integer where pPrint :: forall ann. Integer -> Doc ann
pPrint = Integer -> Doc ann
forall ann. Integer -> Doc ann
integer

instance Pretty Float where pPrint :: forall ann. Float -> Doc ann
pPrint = Float -> Doc ann
forall ann. Float -> Doc ann
float

instance Pretty Double where pPrint :: forall ann. Double -> Doc ann
pPrint = Double -> Doc ann
forall ann. Double -> Doc ann
double

instance Pretty () where pPrint :: forall ann. () -> Doc ann
pPrint ()
_ = String -> Doc ann
forall a. String -> Doc a
text String
"()"

instance Pretty Bool where pPrint :: forall ann. Bool -> Doc ann
pPrint = String -> Doc ann
forall a. String -> Doc a
text (String -> Doc ann) -> (Bool -> String) -> Bool -> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> String
forall a. Show a => a -> String
show

instance Pretty Ordering where pPrint :: forall ann. Ordering -> Doc ann
pPrint = String -> Doc ann
forall a. String -> Doc a
text (String -> Doc ann) -> (Ordering -> String) -> Ordering -> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ordering -> String
forall a. Show a => a -> String
show

instance Pretty Char where
  pPrint :: forall ann. Char -> Doc ann
pPrint = Char -> Doc ann
forall ann. Char -> Doc ann
char
  pPrintList :: forall ann. PrettyLevel -> String -> Doc ann
pPrintList PrettyLevel
_ = String -> Doc ann
forall a. String -> Doc a
text (String -> Doc ann) -> ShowS -> String -> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
forall a. Show a => a -> String
show

instance (Pretty a) => Pretty (Maybe a) where
  pPrintPrec :: forall ann. PrettyLevel -> Rational -> Maybe a -> Doc ann
pPrintPrec PrettyLevel
_ Rational
_ Maybe a
Nothing = String -> Doc ann
forall a. String -> Doc a
text String
"Nothing"
  pPrintPrec PrettyLevel
l Rational
p (Just a
x) =
    Bool -> Doc ann -> Doc ann
forall ann. Bool -> Doc ann -> Doc ann
prettyParen (Rational
p Rational -> Rational -> Bool
forall a. Ord a => a -> a -> Bool
> Rational
appPrec) (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ String -> Doc ann
forall a. String -> Doc a
text String
"Just" Doc ann -> Doc ann -> Doc ann
forall a. Doc a -> Doc a -> Doc a
<+> PrettyLevel -> Rational -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> Rational -> a -> Doc ann
forall ann. PrettyLevel -> Rational -> a -> Doc ann
pPrintPrec PrettyLevel
l (Rational
appPrecRational -> Rational -> Rational
forall a. Num a => a -> a -> a
+Rational
1) a
x

instance (Pretty a, Pretty b) => Pretty (Either a b) where
  pPrintPrec :: forall ann. PrettyLevel -> Rational -> Either a b -> Doc ann
pPrintPrec PrettyLevel
l Rational
p (Left a
x) =
    Bool -> Doc ann -> Doc ann
forall ann. Bool -> Doc ann -> Doc ann
prettyParen (Rational
p Rational -> Rational -> Bool
forall a. Ord a => a -> a -> Bool
> Rational
appPrec) (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ String -> Doc ann
forall a. String -> Doc a
text String
"Left" Doc ann -> Doc ann -> Doc ann
forall a. Doc a -> Doc a -> Doc a
<+> PrettyLevel -> Rational -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> Rational -> a -> Doc ann
forall ann. PrettyLevel -> Rational -> a -> Doc ann
pPrintPrec PrettyLevel
l (Rational
appPrecRational -> Rational -> Rational
forall a. Num a => a -> a -> a
+Rational
1) a
x
  pPrintPrec PrettyLevel
l Rational
p (Right b
x) =
    Bool -> Doc ann -> Doc ann
forall ann. Bool -> Doc ann -> Doc ann
prettyParen (Rational
p Rational -> Rational -> Bool
forall a. Ord a => a -> a -> Bool
> Rational
appPrec) (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ String -> Doc ann
forall a. String -> Doc a
text String
"Right" Doc ann -> Doc ann -> Doc ann
forall a. Doc a -> Doc a -> Doc a
<+> PrettyLevel -> Rational -> b -> Doc ann
forall a ann. Pretty a => PrettyLevel -> Rational -> a -> Doc ann
forall ann. PrettyLevel -> Rational -> b -> Doc ann
pPrintPrec PrettyLevel
l (Rational
appPrecRational -> Rational -> Rational
forall a. Num a => a -> a -> a
+Rational
1) b
x

instance (Pretty a) => Pretty [a] where
  pPrintPrec :: forall ann. PrettyLevel -> Rational -> [a] -> Doc ann
pPrintPrec PrettyLevel
l Rational
_ = PrettyLevel -> [a] -> Doc ann
forall a ann. Pretty a => PrettyLevel -> [a] -> Doc ann
forall ann. PrettyLevel -> [a] -> Doc ann
pPrintList PrettyLevel
l

instance (Pretty a, Pretty b) => Pretty (a, b) where
  pPrintPrec :: forall ann. PrettyLevel -> Rational -> (a, b) -> Doc ann
pPrintPrec PrettyLevel
l Rational
_ (a
a, b
b) =
    Doc ann -> Doc ann
forall a. Doc a -> Doc a
parens (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ [Doc ann] -> Doc ann
forall a. [Doc a] -> Doc a
fsep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$ Doc ann -> [Doc ann] -> [Doc ann]
forall a. Doc a -> [Doc a] -> [Doc a]
punctuate Doc ann
forall a. Doc a
comma [PrettyLevel -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l a
a, PrettyLevel -> b -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l b
b]

instance (Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) where
  pPrintPrec :: forall ann. PrettyLevel -> Rational -> (a, b, c) -> Doc ann
pPrintPrec PrettyLevel
l Rational
_ (a
a, b
b, c
c) =
    Doc ann -> Doc ann
forall a. Doc a -> Doc a
parens (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ [Doc ann] -> Doc ann
forall a. [Doc a] -> Doc a
fsep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$ Doc ann -> [Doc ann] -> [Doc ann]
forall a. Doc a -> [Doc a] -> [Doc a]
punctuate Doc ann
forall a. Doc a
comma [PrettyLevel -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l a
a, PrettyLevel -> b -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l b
b, PrettyLevel -> c -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l c
c]

instance (Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) where
  pPrintPrec :: forall ann. PrettyLevel -> Rational -> (a, b, c, d) -> Doc ann
pPrintPrec PrettyLevel
l Rational
_ (a
a, b
b, c
c, d
d) =
    Doc ann -> Doc ann
forall a. Doc a -> Doc a
parens (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ [Doc ann] -> Doc ann
forall a. [Doc a] -> Doc a
fsep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$ Doc ann -> [Doc ann] -> [Doc ann]
forall a. Doc a -> [Doc a] -> [Doc a]
punctuate Doc ann
forall a. Doc a
comma
      [PrettyLevel -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l a
a, PrettyLevel -> b -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l b
b, PrettyLevel -> c -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l c
c, PrettyLevel -> d -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l d
d]

instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) where
  pPrintPrec :: forall ann. PrettyLevel -> Rational -> (a, b, c, d, e) -> Doc ann
pPrintPrec PrettyLevel
l Rational
_ (a
a, b
b, c
c, d
d, e
e) =
    Doc ann -> Doc ann
forall a. Doc a -> Doc a
parens (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ [Doc ann] -> Doc ann
forall a. [Doc a] -> Doc a
fsep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$ Doc ann -> [Doc ann] -> [Doc ann]
forall a. Doc a -> [Doc a] -> [Doc a]
punctuate Doc ann
forall a. Doc a
comma
      [PrettyLevel -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l a
a, PrettyLevel -> b -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l b
b, PrettyLevel -> c -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l c
c, PrettyLevel -> d -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l d
d, PrettyLevel -> e -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l e
e]

instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f) where
  pPrintPrec :: forall ann.
PrettyLevel -> Rational -> (a, b, c, d, e, f) -> Doc ann
pPrintPrec PrettyLevel
l Rational
_ (a
a, b
b, c
c, d
d, e
e, f
f) =
    Doc ann -> Doc ann
forall a. Doc a -> Doc a
parens (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ [Doc ann] -> Doc ann
forall a. [Doc a] -> Doc a
fsep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$ Doc ann -> [Doc ann] -> [Doc ann]
forall a. Doc a -> [Doc a] -> [Doc a]
punctuate Doc ann
forall a. Doc a
comma
      [PrettyLevel -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l a
a, PrettyLevel -> b -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l b
b, PrettyLevel -> c -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l c
c,
        PrettyLevel -> d -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l d
d, PrettyLevel -> e -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l e
e, PrettyLevel -> f -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l f
f]

instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) =>
         Pretty (a, b, c, d, e, f, g) where
  pPrintPrec :: forall ann.
PrettyLevel -> Rational -> (a, b, c, d, e, f, g) -> Doc ann
pPrintPrec PrettyLevel
l Rational
_ (a
a, b
b, c
c, d
d, e
e, f
f, g
g) =
    Doc ann -> Doc ann
forall a. Doc a -> Doc a
parens (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ [Doc ann] -> Doc ann
forall a. [Doc a] -> Doc a
fsep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$ Doc ann -> [Doc ann] -> [Doc ann]
forall a. Doc a -> [Doc a] -> [Doc a]
punctuate Doc ann
forall a. Doc a
comma
      [PrettyLevel -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l a
a, PrettyLevel -> b -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l b
b, PrettyLevel -> c -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l c
c,
        PrettyLevel -> d -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l d
d, PrettyLevel -> e -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l e
e, PrettyLevel -> f -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l f
f, PrettyLevel -> g -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l g
g]

instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h) =>
         Pretty (a, b, c, d, e, f, g, h) where
  pPrintPrec :: forall ann.
PrettyLevel -> Rational -> (a, b, c, d, e, f, g, h) -> Doc ann
pPrintPrec PrettyLevel
l Rational
_ (a
a, b
b, c
c, d
d, e
e, f
f, g
g, h
h) =
    Doc ann -> Doc ann
forall a. Doc a -> Doc a
parens (Doc ann -> Doc ann) -> Doc ann -> Doc ann
forall a b. (a -> b) -> a -> b
$ [Doc ann] -> Doc ann
forall a. [Doc a] -> Doc a
fsep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$ Doc ann -> [Doc ann] -> [Doc ann]
forall a. Doc a -> [Doc a] -> [Doc a]
punctuate Doc ann
forall a. Doc a
comma
      [PrettyLevel -> a -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l a
a, PrettyLevel -> b -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l b
b, PrettyLevel -> c -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l c
c,
        PrettyLevel -> d -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l d
d, PrettyLevel -> e -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l e
e, PrettyLevel -> f -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l f
f, PrettyLevel -> g -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l g
g, PrettyLevel -> h -> Doc ann
forall a ann. Pretty a => PrettyLevel -> a -> Doc ann
pPrint0 PrettyLevel
l h
h]