diff --git a/CHANGELOG.md b/CHANGELOG.md index 570331c4a..8b2f96c1b 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 ([#663]). ### Removed @@ -302,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 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] ``` 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 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.