Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions prettyprinter-ansi-terminal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Unreleased
# [1.1.4] – April 2026

- Drop support for GHC 7.
- [Add `text` flag](https://github.com/quchen/prettyprinter/pull/279)
- [Fix inconsistency between `renderLazy`/`renderIO`](https://github.com/quchen/prettyprinter/pull/261)
- [Drop support for GHC 7](https://github.com/quchen/prettyprinter/pull/278)
- [Make it compile with MicroHs](https://github.com/quchen/prettyprinter/pull/270)

[1.1.4]: https://github.com/quchen/prettyprinter/compare/ansi-terminal-v1.1.3...ansi-terminal-v1.1.4

# [1.1.3]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: prettyprinter-ansi-terminal
version: 1.1.3
version: 1.1.4
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: ANSI terminal backend for the »prettyprinter« package.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: prettyprinter-compat-annotated-wl-pprint
version: 1.1
version: 1.1.1
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: Drop-in compatibility package to migrate from »annotated-wl-pprint« to »prettyprinter«.
Expand Down
7 changes: 5 additions & 2 deletions prettyprinter-compat-ansi-wl-pprint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Unreleased
# [1.1.1] – April 2026

- Drop support for GHC 7.
- [Drop support for GHC 7](https://github.com/quchen/prettyprinter/pull/278)
- [Make it compile with MicroHs](https://github.com/quchen/prettyprinter/pull/270)

[1.1.1]: https://github.com/quchen/prettyprinter/compare/compat-ansi-wl-pprint-1.1...compat-ansi-wl-pprint-1.1.1

# [1.1]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: prettyprinter-compat-ansi-wl-pprint
version: 1.1
version: 1.1.1
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: Drop-in compatibility package to migrate from »ansi-wl-pprint« to »prettyprinter«.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: prettyprinter-compat-wl-pprint
version: 1.0.1
version: 1.0.2
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: Drop-in compatibility package to migrate from »wl-pprint« to »prettyprinter«.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: prettyprinter-convert-ansi-wl-pprint
version: 1.1.2
version: 1.1.3
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: Converter from »ansi-wl-pprint« documents to »prettyprinter«-based ones.
Expand Down
15 changes: 13 additions & 2 deletions prettyprinter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Unreleased
# [1.7.2] – April 2026

- [Add `PrettyAnn` type class](https://github.com/quchen/prettyprinter/pull/256)
- [Add `Pretty` instances for 4-7 tuples](https://github.com/quchen/prettyprinter/pull/275)
- [Add instance `ann ~ Void => Pretty (Doc ann)`](https://github.com/quchen/prettyprinter/pull/234)
- [Drop support for GHC 7](https://github.com/quchen/prettyprinter/pull/278)
- [Make it compile with MicroHs](https://github.com/quchen/prettyprinter/pull/270)
- [Remove the MINIMAL pragma from `Pretty`](https://github.com/quchen/prettyprinter/pull/219)
- Documentation improvements:
* [#229](https://github.com/quchen/prettyprinter/pull/229)
* [#255](https://github.com/quchen/prettyprinter/pull/255)
* [#273](https://github.com/quchen/prettyprinter/pull/273)

- Drop support for GHC 7.
[1.7.2]: https://github.com/quchen/prettyprinter/compare/v1.7.1...v1.7.2

# [1.7.1]

Expand Down
2 changes: 1 addition & 1 deletion prettyprinter/prettyprinter.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: prettyprinter
version: 1.7.1
version: 1.7.2
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: A modern, easy to use, well-documented, extensible pretty-printer.
Expand Down
44 changes: 39 additions & 5 deletions prettyprinter/src/Prettyprinter/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ class Pretty a where
-- , (1, [2, 2, 2, 2, 2, 2, 2, 2])
-- , (1, [2, 2, 2, 2, 2, 2, 2, 2]) ] ]

-- | @since 1.7.2
instance ann ~ Void => Pretty (Doc ann) where
pretty = vacuous

Expand Down Expand Up @@ -351,7 +352,7 @@ instance Pretty Char where
-- | This class is similar to 'Pretty', but allows you to embed annotations in
-- the 'Doc'.
--
-- @since FIXME
-- @since 1.7.2
class PrettyAnn ann a where

prettyAnn :: a -> Doc ann
Expand All @@ -362,27 +363,35 @@ class PrettyAnn ann a where
prettyAnnList :: [a] -> Doc ann
prettyAnnList = align . list . map prettyAnn

-- | @since 1.7.2
instance PrettyAnn ann (Doc ann) where
prettyAnn = id

-- | @since 1.7.2
instance PrettyAnn ann a => PrettyAnn ann (Const a b) where
prettyAnn = prettyAnn . getConst

#if FUNCTOR_IDENTITY_IN_BASE
-- | @since 1.7.2
instance PrettyAnn ann a => PrettyAnn ann (Identity a) where
prettyAnn = prettyAnn . runIdentity
#endif

-- | @since 1.7.2
instance PrettyAnn ann a => PrettyAnn ann [a] where
prettyAnn = prettyAnnList

-- | @since 1.7.2
instance PrettyAnn ann a => PrettyAnn ann (NonEmpty a) where
prettyAnn (x:|xs) = prettyAnnList (x:xs)

-- | @since 1.7.2
instance PrettyAnn ann () where prettyAnn = pretty

-- | @since 1.7.2
instance PrettyAnn ann Bool where prettyAnn = pretty

-- | @since 1.7.2
instance PrettyAnn ann Char where
prettyAnn = pretty
prettyAnnList = prettyList
Expand Down Expand Up @@ -440,28 +449,28 @@ instance (Pretty a1, Pretty a2, Pretty a3) => Pretty (a1,a2,a3) where
-- | >>> pretty (123, "hello", False, ())
-- (123, hello, False, ())
--
-- @since FIXME
-- @since 1.7.2
instance (Pretty a1, Pretty a2, Pretty a3, Pretty a4) => Pretty (a1,a2,a3,a4) where
pretty (x1,x2,x3,x4) = tupled [pretty x1, pretty x2, pretty x3, pretty x4]

-- | >>> pretty (123, "hello", False, (), 3.14)
-- (123, hello, False, (), 3.14)
--
-- @since FIXME
-- @since 1.7.2
instance (Pretty a1, Pretty a2, Pretty a3, Pretty a4, Pretty a5) => Pretty (a1,a2,a3,a4,a5) where
pretty (x1,x2,x3,x4,x5) = tupled [pretty x1, pretty x2, pretty x3, pretty x4, pretty x5]

-- | >>> pretty (123, "hello", False, (), 3.14, Just 2.71)
-- (123, hello, False, (), 3.14, 2.71)
--
-- @since FIXME
-- @since 1.7.2
instance (Pretty a1, Pretty a2, Pretty a3, Pretty a4, Pretty a5, Pretty a6) => Pretty (a1,a2,a3,a4,a5,a6) where
pretty (x1,x2,x3,x4,x5,x6) = tupled [pretty x1, pretty x2, pretty x3, pretty x4, pretty x5, pretty x6]

-- | >>> pretty (123, "hello", False, (), 3.14, Just 2.71, [1,2,3])
-- (123, hello, False, (), 3.14, 2.71, [1, 2, 3])
--
-- @since FIXME
-- @since 1.7.2
instance (Pretty a1, Pretty a2, Pretty a3, Pretty a4, Pretty a5, Pretty a6, Pretty a7) => Pretty (a1,a2,a3,a4,a5,a6,a7) where
pretty (x1,x2,x3,x4,x5,x6,x7) = tupled [pretty x1, pretty x2, pretty x3, pretty x4, pretty x5, pretty x6, pretty x7]

Expand Down Expand Up @@ -506,55 +515,80 @@ instance Pretty Lazy.Text
-- []
instance Pretty Void where pretty = absurd

-- | @since 1.7.2
instance PrettyAnn ann Int where prettyAnn = pretty
-- | @since 1.7.2
instance PrettyAnn ann Int8 where prettyAnn = pretty
-- | @since 1.7.2
instance PrettyAnn ann Int16 where prettyAnn = pretty
-- | @since 1.7.2
instance PrettyAnn ann Int32 where prettyAnn = pretty
-- | @since 1.7.2
instance PrettyAnn ann Int64 where prettyAnn = pretty
-- | @since 1.7.2
instance PrettyAnn ann Word where prettyAnn = pretty
-- | @since 1.7.2
instance PrettyAnn ann Word8 where prettyAnn = pretty
-- | @since 1.7.2
instance PrettyAnn ann Word16 where prettyAnn = pretty
-- | @since 1.7.2
instance PrettyAnn ann Word32 where prettyAnn = pretty
-- | @since 1.7.2
instance PrettyAnn ann Word64 where prettyAnn = pretty

-- | @since 1.7.2
instance PrettyAnn ann Integer where prettyAnn = pretty

#if NATURAL_IN_BASE
-- | @since 1.7.2
instance PrettyAnn ann Natural where prettyAnn = pretty
#endif

-- | @since 1.7.2
-- | @since 1.7.2
instance PrettyAnn ann Float where prettyAnn = pretty

-- | @since 1.7.2
instance PrettyAnn ann Double where prettyAnn = pretty

-- | @since 1.7.2
instance (PrettyAnn ann a1, PrettyAnn ann a2) => PrettyAnn ann (a1,a2) where
prettyAnn (x1,x2) = tupled [prettyAnn x1, prettyAnn x2]

-- | @since 1.7.2
instance (PrettyAnn ann a1, PrettyAnn ann a2, PrettyAnn ann a3) => PrettyAnn ann (a1,a2,a3) where
prettyAnn (x1,x2,x3) = tupled [prettyAnn x1, prettyAnn x2, prettyAnn x3]

-- | @since 1.7.2
instance (PrettyAnn ann a1, PrettyAnn ann a2, PrettyAnn ann a3, PrettyAnn ann a4) => PrettyAnn ann (a1,a2,a3,a4) where
prettyAnn (x1,x2,x3,x4) = tupled [prettyAnn x1, prettyAnn x2, prettyAnn x3, prettyAnn x4]

-- | @since 1.7.2
instance (PrettyAnn ann a1, PrettyAnn ann a2, PrettyAnn ann a3, PrettyAnn ann a4, PrettyAnn ann a5) => PrettyAnn ann (a1,a2,a3,a4,a5) where
prettyAnn (x1,x2,x3,x4,x5) = tupled [prettyAnn x1, prettyAnn x2, prettyAnn x3, prettyAnn x4, prettyAnn x5]

-- | @since 1.7.2
instance (PrettyAnn ann a1, PrettyAnn ann a2, PrettyAnn ann a3, PrettyAnn ann a4, PrettyAnn ann a5, PrettyAnn ann a6) => PrettyAnn ann (a1,a2,a3,a4,a5,a6) where
prettyAnn (x1,x2,x3,x4,x5,x6) = tupled [prettyAnn x1, prettyAnn x2, prettyAnn x3, prettyAnn x4, prettyAnn x5, prettyAnn x6]

-- | @since 1.7.2
instance (PrettyAnn ann a1, PrettyAnn ann a2, PrettyAnn ann a3, PrettyAnn ann a4, PrettyAnn ann a5, PrettyAnn ann a6, PrettyAnn ann a7) => PrettyAnn ann (a1,a2,a3,a4,a5,a6,a7) where
prettyAnn (x1,x2,x3,x4,x5,x6,x7) = tupled [prettyAnn x1, prettyAnn x2, prettyAnn x3, prettyAnn x4, prettyAnn x5, prettyAnn x6, prettyAnn x7]

-- | @since 1.7.2
instance PrettyAnn ann a => PrettyAnn ann (Maybe a) where
prettyAnn = maybe mempty prettyAnn
prettyAnnList = prettyAnnList . catMaybes

#ifdef MIN_VERSION_text
-- | @since 1.7.2
instance PrettyAnn ann Text where prettyAnn = pretty

-- | @since 1.7.2
instance PrettyAnn ann Lazy.Text where prettyAnn = pretty
#endif

-- | @since 1.7.2
instance PrettyAnn ann Void where prettyAnn = absurd


Expand Down
Loading