From 354c9b09f2118e63c1827c8e872f0e51fefc3e3c Mon Sep 17 00:00:00 2001 From: Artin Ghasivand Date: Sun, 8 Feb 2026 21:45:14 +0330 Subject: [PATCH 1/5] Fix of #243 (uncomment Pretty instances for {4,5,6,7}-tuple) The code was already there, so I just uncommented it. --- prettyprinter/src/Prettyprinter/Internal.hs | 64 ++++++++++----------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/prettyprinter/src/Prettyprinter/Internal.hs b/prettyprinter/src/Prettyprinter/Internal.hs index f2c20c31..c891b0f0 100755 --- a/prettyprinter/src/Prettyprinter/Internal.hs +++ b/prettyprinter/src/Prettyprinter/Internal.hs @@ -397,36 +397,36 @@ instance (Pretty a1, Pretty a2) => Pretty (a1,a2) where instance (Pretty a1, Pretty a2, Pretty a3) => Pretty (a1,a2,a3) where pretty (x1,x2,x3) = tupled [pretty x1, pretty x2, pretty x3] --- -- | >>> pretty (123, "hello", False, ()) --- -- (123, hello, False, ()) --- 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) --- 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 ) --- 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] ) --- 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] +-- | >>> pretty (123, "hello", False, ()) +-- (123, hello, False, ()) +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) +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 ) +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] ) +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] -- | Ignore 'Nothing's, print 'Just' contents. -- @@ -1810,8 +1810,8 @@ defaultLayoutOptions = LayoutOptions { layoutPageWidth = defaultPageWidth } -- | This is the default layout algorithm, and it is used by 'show', 'putDoc' -- and 'hPutDoc'. -- --- @'layoutPretty'@ commits to rendering something in a certain way if the --- remainder of the current line fits the layout constraints; in other words, +-- @'layoutPretty'@ commits to rendering something in a certain way if the +-- remainder of the current line fits the layout constraints; in other words, -- it has up to one line of lookahead when rendering. Consider using the -- smarter, but a bit less performant, @'layoutSmart'@ algorithm if the results -- seem to run off to the right before having lots of line breaks. From f1e81305e57ea8e292371dfe43deb3584c78bbcf Mon Sep 17 00:00:00 2001 From: Artin Ghasivand Date: Sun, 8 Feb 2026 23:13:25 +0330 Subject: [PATCH 2/5] Fix doctests --- prettyprinter/src/Prettyprinter/Internal.hs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/prettyprinter/src/Prettyprinter/Internal.hs b/prettyprinter/src/Prettyprinter/Internal.hs index c891b0f0..9c48b164 100755 --- a/prettyprinter/src/Prettyprinter/Internal.hs +++ b/prettyprinter/src/Prettyprinter/Internal.hs @@ -408,23 +408,12 @@ instance (Pretty a1, Pretty a2, Pretty a3, Pretty a4, Pretty a5) => Pretty (a1,a 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 ) +-- (123, hello, False, (), 3.14, 2.71) 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] ) +-- (123, hello, False, (), 3.14, 2.71) 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] From 31ee729f366f3e05069b204917f395a0f8765b52 Mon Sep 17 00:00:00 2001 From: Artin Ghasivand Date: Sun, 8 Feb 2026 23:21:26 +0330 Subject: [PATCH 3/5] Add since FIXME comments --- prettyprinter/src/Prettyprinter/Internal.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/prettyprinter/src/Prettyprinter/Internal.hs b/prettyprinter/src/Prettyprinter/Internal.hs index 9c48b164..0f2c5c38 100755 --- a/prettyprinter/src/Prettyprinter/Internal.hs +++ b/prettyprinter/src/Prettyprinter/Internal.hs @@ -399,21 +399,25 @@ instance (Pretty a1, Pretty a2, Pretty a3) => Pretty (a1,a2,a3) where -- | >>> pretty (123, "hello", False, ()) -- (123, hello, False, ()) +-- @since FIXME 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 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 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) +-- (123, hello, False, (), 3.14, 2.71, [1,2,3]) +-- @since FIXME 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] From cfd58fb3a5e8121482be482c74b375a7a715519d Mon Sep 17 00:00:00 2001 From: Artin Ghasivand Date: Sun, 8 Feb 2026 23:25:46 +0330 Subject: [PATCH 4/5] Fix since FIXME comments --- prettyprinter/src/Prettyprinter/Internal.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prettyprinter/src/Prettyprinter/Internal.hs b/prettyprinter/src/Prettyprinter/Internal.hs index 0f2c5c38..86ed0d1f 100755 --- a/prettyprinter/src/Prettyprinter/Internal.hs +++ b/prettyprinter/src/Prettyprinter/Internal.hs @@ -399,24 +399,28 @@ instance (Pretty a1, Pretty a2, Pretty a3) => Pretty (a1,a2,a3) where -- | >>> pretty (123, "hello", False, ()) -- (123, hello, False, ()) +-- -- @since FIXME 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 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 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 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] From e4b1b19d020e76418cf5628d2732373773eb324f Mon Sep 17 00:00:00 2001 From: Artin Ghasivand Date: Sun, 8 Feb 2026 23:34:12 +0330 Subject: [PATCH 5/5] Fix doctest for lists --- prettyprinter/src/Prettyprinter/Internal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prettyprinter/src/Prettyprinter/Internal.hs b/prettyprinter/src/Prettyprinter/Internal.hs index 86ed0d1f..a4c204f9 100755 --- a/prettyprinter/src/Prettyprinter/Internal.hs +++ b/prettyprinter/src/Prettyprinter/Internal.hs @@ -419,7 +419,7 @@ instance (Pretty a1, Pretty a2, Pretty a3, Pretty a4, Pretty a5, Pretty a6) => P 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]) +-- (123, hello, False, (), 3.14, 2.71, [1, 2, 3]) -- -- @since FIXME instance (Pretty a1, Pretty a2, Pretty a3, Pretty a4, Pretty a5, Pretty a6, Pretty a7) => Pretty (a1,a2,a3,a4,a5,a6,a7) where