diff --git a/src/Text/Pretty/Simple.hs b/src/Text/Pretty/Simple.hs index c6a21b0..13a7cf9 100644 --- a/src/Text/Pretty/Simple.hs +++ b/src/Text/Pretty/Simple.hs @@ -680,6 +680,15 @@ layoutStringAnsi opts = fmap convertStyle . layoutString opts -- , B -- ( B ( B A ) ) ] ) -- +-- >>> pPrintOpt CheckColorTty defaultOutputOptionsDarkBg {outputOptionsCompact = True} $ [("id", 123), ("state", 1), ("pass", 1), ("tested", 100), ("time", 12345)] +-- [ +-- ( "id", 123 ), +-- ( "state", 1 ), +-- ( "pass", 1 ), +-- ( "tested", 100 ), +-- ( "time", 12345 ) +-- ] +-- -- __Initial indent__ -- -- >>> pPrintOpt CheckColorTty defaultOutputOptionsDarkBg {outputOptionsInitialIndent = 3} $ B ( B ( B ( B A ) ) ) diff --git a/src/Text/Pretty/Simple/Internal/Printer.hs b/src/Text/Pretty/Simple/Internal/Printer.hs index 14c64ae..8185989 100644 --- a/src/Text/Pretty/Simple/Internal/Printer.hs +++ b/src/Text/Pretty/Simple/Internal/Printer.hs @@ -255,7 +255,8 @@ prettyExpr opts = (if outputOptionsCompact opts then group else id) . \case spaceIfNeeded = \case Other (' ' : _) : _ -> mempty _ -> space - lineAndCommaSep x y = x <> line' <> annotate Comma "," <> y + lineAndCommaSep x y = x <> munless (outputOptionsCompact opts) line' <> annotate Comma "," <> y + munless b x = if b then mempty else x -- | Determine whether this expression should be displayed on a single line. isSimple :: Expr -> Bool diff --git a/stack.yaml b/stack.yaml index 40321c8..f372e8a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,7 +1,7 @@ # For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration.html # Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) -resolver: lts-18.02 +resolver: lts-18.28 # Local packages, usually specified by relative directory name packages: