From a8d0fc47f78877ff532ed7dfa85c70df229e7c3a Mon Sep 17 00:00:00 2001 From: Hiroki Tokunaga Date: Fri, 6 Jan 2023 10:28:34 +0900 Subject: [PATCH 1/5] Add a changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 570331c4a..6a04d2e7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This switch causes changes in the formatting results in some cases. - Changed how to format a data type with a record constructor to follow the [Johan Tibell's Haskell Style Guide]. ([#662]). +- A newline is no longer inserted after a pattern signature. ### Removed From ea592b122b6780bc5087526e0c3887b84d774915 Mon Sep 17 00:00:00 2001 From: Hiroki Tokunaga Date: Fri, 6 Jan 2023 10:29:26 +0900 Subject: [PATCH 2/5] Add the PR's index --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a04d2e7f..8b2f96c1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ This switch causes changes in the formatting results in some cases. - Changed how to format a data type with a record constructor to follow the [Johan Tibell's Haskell Style Guide]. ([#662]). -- A newline is no longer inserted after a pattern signature. +- A newline is no longer inserted after a pattern signature ([#663]). ### Removed @@ -303,6 +303,7 @@ This version is accidentally pushlished, and is the same as 5.3.3. [@uhbif19]: https://github.com/uhbif19 [@toku-sa-n]: https://github.com/toku-sa-n +[#663]: https://github.com/mihaimaruseac/hindent/pull/663 [#662]: https://github.com/mihaimaruseac/hindent/pull/662 [#588]: https://github.com/mihaimaruseac/hindent/pull/588 [#584]: https://github.com/mihaimaruseac/hindent/pull/584 From 6eadaab79ec0aca114d486bc1cc3f68825de487d Mon Sep 17 00:00:00 2001 From: Hiroki Tokunaga Date: Fri, 6 Jan 2023 10:29:59 +0900 Subject: [PATCH 3/5] Update the test --- TESTS.md | 1 - 1 file changed, 1 deletion(-) diff --git a/TESTS.md b/TESTS.md index 46a2c5310..28e14bb97 100644 --- a/TESTS.md +++ b/TESTS.md @@ -1289,7 +1289,6 @@ Unidirectional with a pattern type signature {-# LANGUAGE PatternSynonyms #-} pattern Foo :: Int -> Int -> [Int] - pattern Foo x y <- [x, y] ``` From 0bdd7d04d17ee17724c5b07a4bff4b9ebfed89aa Mon Sep 17 00:00:00 2001 From: Hiroki Tokunaga Date: Fri, 6 Jan 2023 10:32:21 +0900 Subject: [PATCH 4/5] Do not insert a newline after a pattern signature --- src/HIndent/Pretty.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/HIndent/Pretty.hs b/src/HIndent/Pretty.hs index fff384a9b..1cde27548 100644 --- a/src/HIndent/Pretty.hs +++ b/src/HIndent/Pretty.hs @@ -157,6 +157,7 @@ instance Pretty HsModule where (x, Just $ declSeparator $ unLoc x) : addDeclSeparator xs declSeparator (SigD _ TypeSig {}) = newline declSeparator (SigD _ InlineSig {}) = newline + declSeparator (SigD _ PatSynSig {}) = newline declSeparator _ = blankline declsExist = not . null . hsmodDecls prettyImports = importDecls >>= blanklined . fmap outputImportGroup From 7d3e32577307414d161747c0fad1b55354a51a9f Mon Sep 17 00:00:00 2001 From: Hiroki Tokunaga Date: Fri, 6 Jan 2023 10:33:58 +0900 Subject: [PATCH 5/5] Format --- src/HIndent/Pretty/Types.hs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/HIndent/Pretty/Types.hs b/src/HIndent/Pretty/Types.hs index 27e931a30..55fb88121 100644 --- a/src/HIndent/Pretty/Types.hs +++ b/src/HIndent/Pretty/Types.hs @@ -121,17 +121,14 @@ data HsSigType' = HsSigType' -- | `HsSigType'` for instance declarations. pattern HsSigTypeInsideInstDecl :: HsSigType GhcPs -> HsSigType' - pattern HsSigTypeInsideInstDecl x = HsSigType' HsTypeForInstDecl HsTypeNoDir x -- | `HsSigType'` for function declarations; printed horizontally. pattern HsSigTypeInsideVerticalFuncSig :: HsSigType GhcPs -> HsSigType' - pattern HsSigTypeInsideVerticalFuncSig x = HsSigType' HsTypeForFuncSig HsTypeVertical x -- | `HsSigType'` for a top-level function signature. pattern HsSigTypeInsideDeclSig :: HsSigType GhcPs -> HsSigType' - pattern HsSigTypeInsideDeclSig x = HsSigType' HsTypeForDeclSig HsTypeNoDir x -- | A wrapper for `HsType`. @@ -144,17 +141,14 @@ data HsType' = HsType' -- | `HsType'` inside a function signature declaration; printed horizontally. pattern HsTypeInsideVerticalFuncSig :: HsType GhcPs -> HsType' - pattern HsTypeInsideVerticalFuncSig x = HsType' HsTypeForFuncSig HsTypeVertical x -- | `HsType'` inside a top-level function signature declaration. pattern HsTypeInsideDeclSig :: HsType GhcPs -> HsType' - pattern HsTypeInsideDeclSig x = HsType' HsTypeForDeclSig HsTypeNoDir x -- | `HsType'` inside a instance signature declaration. pattern HsTypeInsideInstDecl :: HsType GhcPs -> HsType' - pattern HsTypeInsideInstDecl x = HsType' HsTypeForInstDecl HsTypeNoDir x -- | `StmtLR` inside a vertically printed list.