diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 8c24d11..b5b36ca 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -11,8 +11,8 @@ steps: command: | nix-build --keep-going --no-out-link --argstr ormoluCompiler ghc8103 timeout: 100 - - wait - - label: Check formatting - command: | - ./format.sh - git diff --exit-code --color=always + # - wait + # - label: Check formatting + # command: | + # ./format.sh + # git diff --exit-code --color=always diff --git a/data/examples/declaration/class/default-signatures-out.hs b/data/examples/declaration/class/default-signatures-out.hs index 4d1530d..94c9100 100644 --- a/data/examples/declaration/class/default-signatures-out.hs +++ b/data/examples/declaration/class/default-signatures-out.hs @@ -11,8 +11,8 @@ class Bar a where a -- Pointless comment default bar :: - ( Read a, - Semigroup a + ( Read a + , Semigroup a ) => a -> a -> diff --git a/data/examples/declaration/class/dependency-super-classes-out.hs b/data/examples/declaration/class/dependency-super-classes-out.hs index 3a52252..a0f2be2 100644 --- a/data/examples/declaration/class/dependency-super-classes-out.hs +++ b/data/examples/declaration/class/dependency-super-classes-out.hs @@ -9,8 +9,8 @@ class (MonadReader r s, MonadWriter w m) => MonadState s m | m -> s where -- | 'MonadParsec' class - ( Stream s, -- Token streams - MonadPlus m -- Potential for failure + ( Stream s -- Token streams + , MonadPlus m -- Potential for failure ) => MonadParsec e s m | m -> e s diff --git a/data/examples/declaration/class/functional-dependencies-out.hs b/data/examples/declaration/class/functional-dependencies-out.hs index f00081c..c239b35 100644 --- a/data/examples/declaration/class/functional-dependencies-out.hs +++ b/data/examples/declaration/class/functional-dependencies-out.hs @@ -10,10 +10,10 @@ class Bar a b | a -> b, b -> a where bar :: a -- | Something else. class Baz a b c d - | a b -> c d, -- Foo - b c -> a d, -- Bar - a c -> b d, -- Baz - a c d -> b, - a b d -> a b c d + | a b -> c d -- Foo + , b c -> a d -- Bar + , a c -> b d -- Baz + , a c d -> b + , a b d -> a b c d where baz :: a -> b diff --git a/data/examples/declaration/class/single-parameters-out.hs b/data/examples/declaration/class/single-parameters-out.hs index d197aec..b0c6f3b 100644 --- a/data/examples/declaration/class/single-parameters-out.hs +++ b/data/examples/declaration/class/single-parameters-out.hs @@ -12,8 +12,8 @@ class Baz a where -- | Baz baz :: -- | First argument - ( a, - a + ( a + , a ) -> -- | Second argument a -> diff --git a/data/examples/declaration/class/super-classes-out.hs b/data/examples/declaration/class/super-classes-out.hs index 8fbea95..a9ecde8 100644 --- a/data/examples/declaration/class/super-classes-out.hs +++ b/data/examples/declaration/class/super-classes-out.hs @@ -7,8 +7,8 @@ class Baz a class - ( Foo a, -- Foo? - Bar a, -- Bar? - Baz a -- Baz + ( Foo a -- Foo? + , Bar a -- Bar? + , Baz a -- Baz ) => BarBar a diff --git a/data/examples/declaration/data/deriving-strategies-out.hs b/data/examples/declaration/data/deriving-strategies-out.hs index dac80c2..02e4ba6 100644 --- a/data/examples/declaration/data/deriving-strategies-out.hs +++ b/data/examples/declaration/data/deriving-strategies-out.hs @@ -4,8 +4,8 @@ module Main where newtype Foo = Foo Int deriving stock (Eq, Show, Generic) deriving anyclass - ( ToJSON, - FromJSON + ( ToJSON + , FromJSON ) deriving newtype (Num) deriving (Monoid) via (Sum Int) diff --git a/data/examples/declaration/data/field-layout/record-out.hs b/data/examples/declaration/data/field-layout/record-out.hs index 54d2f94..0eb569c 100644 --- a/data/examples/declaration/data/field-layout/record-out.hs +++ b/data/examples/declaration/data/field-layout/record-out.hs @@ -3,8 +3,8 @@ module Main where -- | Foo. data Foo = Foo { -- | Something - foo :: Foo Int Int, - -- | Something else + foo :: Foo Int Int + , -- | Something else bar :: Bar Char diff --git a/data/examples/declaration/data/gadt/multiple-declaration-out.hs b/data/examples/declaration/data/gadt/multiple-declaration-out.hs index 53d899d..3f39b33 100644 --- a/data/examples/declaration/data/gadt/multiple-declaration-out.hs +++ b/data/examples/declaration/data/gadt/multiple-declaration-out.hs @@ -2,14 +2,14 @@ data GADT0 a where GADT01, GADT02 :: Int -> GADT0 a data GADT1 a where - GADT11, - GADT12 :: + GADT11 + , GADT12 :: Int -> GADT1 a data GADT2 a where - GADT21, - GADT21, - GADT22 :: + GADT21 + , GADT21 + , GADT22 :: Int -> GADT2 a diff --git a/data/examples/declaration/data/gadt/record-out.hs b/data/examples/declaration/data/gadt/record-out.hs index 285463f..2d04e59 100644 --- a/data/examples/declaration/data/gadt/record-out.hs +++ b/data/examples/declaration/data/gadt/record-out.hs @@ -4,11 +4,11 @@ module Main where data Foo where Foo :: {fooX :: Int} -> Foo Bar :: - { fooY :: Int, - fooBar, fooBaz :: Bool, - fooFoo, - barBar, - bazBaz :: + { fooY :: Int + , fooBar, fooBaz :: Bool + , fooFoo + , barBar + , bazBaz :: Int } -> Foo diff --git a/data/examples/declaration/data/record-multi-const-out.hs b/data/examples/declaration/data/record-multi-const-out.hs index f9fa999..14303b7 100644 --- a/data/examples/declaration/data/record-multi-const-out.hs +++ b/data/examples/declaration/data/record-multi-const-out.hs @@ -4,14 +4,14 @@ module Main where data Foo = Foo { -- | X - fooX :: Int, - -- | Y + fooX :: Int + , -- | Y fooY :: Int } | Bar { -- | X - barX :: Int, - -- | Y + barX :: Int + , -- | Y barY :: Int } deriving (Eq, Show) diff --git a/data/examples/declaration/data/record-out.hs b/data/examples/declaration/data/record-out.hs index 7de5945..5838200 100644 --- a/data/examples/declaration/data/record-out.hs +++ b/data/examples/declaration/data/record-out.hs @@ -3,21 +3,21 @@ module Main where -- | Something. data Foo = Foo { -- | X - fooX :: Int, - -- | Y - fooY :: Int, - -- | BarBaz - fooBar, fooBaz :: NonEmpty (Identity Bool), - -- | GagGog - fooGag, - fooGog :: + fooX :: Int + , -- | Y + fooY :: Int + , -- | BarBaz + fooBar, fooBaz :: NonEmpty (Identity Bool) + , -- | GagGog + fooGag + , fooGog :: NonEmpty ( Indentity Bool - ), - -- | Huh! - fooFoo, - barBar :: + ) + , -- | Huh! + fooFoo + , barBar :: Int } deriving (Eq, Show) diff --git a/data/examples/declaration/default/default-out.hs b/data/examples/declaration/default/default-out.hs index 681fe59..e1dee1c 100644 --- a/data/examples/declaration/default/default-out.hs +++ b/data/examples/declaration/default/default-out.hs @@ -1,7 +1,7 @@ default (Int, Foo, Bar) default - ( Int, - Foo, - Bar + ( Int + , Foo + , Bar ) diff --git a/data/examples/declaration/instance/contexts-comments-out.hs b/data/examples/declaration/instance/contexts-comments-out.hs index 40b9799..1a766dc 100644 --- a/data/examples/declaration/instance/contexts-comments-out.hs +++ b/data/examples/declaration/instance/contexts-comments-out.hs @@ -1,16 +1,16 @@ instance - ( Read a, -- Foo - Read b, - Read - ( c, -- Bar - d + ( Read a -- Foo + , Read b + , Read + ( c -- Bar + , d ) ) => Read - ( a, -- Baz - b, - ( c, -- Quux - d + ( a -- Baz + , b + , ( c -- Quux + , d ) ) where diff --git a/data/examples/declaration/instance/contexts-out.hs b/data/examples/declaration/instance/contexts-out.hs index d26ece7..bd1d9e8 100644 --- a/data/examples/declaration/instance/contexts-out.hs +++ b/data/examples/declaration/instance/contexts-out.hs @@ -1,8 +1,8 @@ instance Eq a => Eq [a] where (==) _ _ = False instance - ( Ord a, - Ord b + ( Ord a + , Ord b ) => Ord (a, b) where @@ -11,8 +11,8 @@ instance instance (Show a, Show b) => Show - ( a, - b + ( a + , b ) where showsPrec _ _ = showString "" diff --git a/data/examples/declaration/instance/data-family-instances-out.hs b/data/examples/declaration/instance/data-family-instances-out.hs index bc4e2f7..4144978 100644 --- a/data/examples/declaration/instance/data-family-instances-out.hs +++ b/data/examples/declaration/instance/data-family-instances-out.hs @@ -7,11 +7,11 @@ data instance Foo [Int] = IntListFoo - ( Int, - Int + ( Int + , Int ) - ( Double, - Double + ( Double + , Double ) data instance Bar Double a diff --git a/data/examples/declaration/instance/type-family-instances-out.hs b/data/examples/declaration/instance/type-family-instances-out.hs index 3eadb9b..c305f2a 100644 --- a/data/examples/declaration/instance/type-family-instances-out.hs +++ b/data/examples/declaration/instance/type-family-instances-out.hs @@ -5,8 +5,8 @@ type instance Foo Int = Int type instance Foo [Int] = - ( Int, - Int + ( Int + , Int ) type instance Bar Int [Int] Double = (Int, Double) @@ -16,6 +16,6 @@ type instance [Int] [Int] Double = - ( Int, - Double + ( Int + , Double ) diff --git a/data/examples/declaration/signature/complete/complete-out.hs b/data/examples/declaration/signature/complete/complete-out.hs index 6a292e8..62d0deb 100644 --- a/data/examples/declaration/signature/complete/complete-out.hs +++ b/data/examples/declaration/signature/complete/complete-out.hs @@ -3,8 +3,8 @@ {-# COMPLETE A, B #-} {-# COMPLETE - A, - B, - C :: + A + , B + , C :: Foo #-} diff --git a/data/examples/declaration/signature/minimal/minimal-out.hs b/data/examples/declaration/signature/minimal/minimal-out.hs index 28ce9d3..6457517 100644 --- a/data/examples/declaration/signature/minimal/minimal-out.hs +++ b/data/examples/declaration/signature/minimal/minimal-out.hs @@ -4,8 +4,8 @@ class Foo a where {-# MINIMAL a | ( b, c, d - | e, - f + | e + , f ) | g #-} diff --git a/data/examples/declaration/signature/pattern/multiline-out.hs b/data/examples/declaration/signature/pattern/multiline-out.hs index d656edd..2d2e714 100644 --- a/data/examples/declaration/signature/pattern/multiline-out.hs +++ b/data/examples/declaration/signature/pattern/multiline-out.hs @@ -6,14 +6,14 @@ pattern Arrow :: Type pattern - Foo, - Bar :: + Foo + , Bar :: Type -> Type -> Type pattern - TypeSignature, - FunctionBody, - PatternSignature, - WarningPragma :: + TypeSignature + , FunctionBody + , PatternSignature + , WarningPragma :: [RdrName] -> HsDecl GhcPs diff --git a/data/examples/declaration/signature/specialize/specialize-out.hs b/data/examples/declaration/signature/specialize/specialize-out.hs index 21433bc..211cc1b 100644 --- a/data/examples/declaration/signature/specialize/specialize-out.hs +++ b/data/examples/declaration/signature/specialize/specialize-out.hs @@ -17,8 +17,8 @@ baz = id {-# SPECIALIZE fits13Bits :: Int -> Bool, Integer -> Bool #-} {-# SPECIALIZE fits13Bits :: Int -> - Bool, - Integer -> Bool + Bool + , Integer -> Bool #-} fits13Bits :: Integral a => a -> Bool fits13Bits x = x >= -4096 && x < 4096 diff --git a/data/examples/declaration/signature/type/context-multi-line-out.hs b/data/examples/declaration/signature/type/context-multi-line-out.hs index da05686..5b028f5 100644 --- a/data/examples/declaration/signature/type/context-multi-line-out.hs +++ b/data/examples/declaration/signature/type/context-multi-line-out.hs @@ -1,7 +1,7 @@ functionName :: - ( C1, - C2, - C3 + ( C1 + , C2 + , C3 ) => a -> b -> diff --git a/data/examples/declaration/signature/type/multi-value-out.hs b/data/examples/declaration/signature/type/multi-value-out.hs index 34d58a1..7e48fd7 100644 --- a/data/examples/declaration/signature/type/multi-value-out.hs +++ b/data/examples/declaration/signature/type/multi-value-out.hs @@ -7,9 +7,9 @@ a = 1 b = 2 c = 3 -foo, - bar, - baz :: +foo + , bar + , baz :: Int bar = 2 baz = 3 diff --git a/data/examples/declaration/value/function/arithmetic-sequences-out.hs b/data/examples/declaration/value/function/arithmetic-sequences-out.hs index 99293e6..f10d2ce 100644 --- a/data/examples/declaration/value/function/arithmetic-sequences-out.hs +++ b/data/examples/declaration/value/function/arithmetic-sequences-out.hs @@ -4,13 +4,13 @@ foo' = [0 .. 5] bar x = [ 0 - .. x + .. x ] baz x = - [ 1, - 3 - .. x + [ 1 + , 3 + .. x ] barbaz x = [0, 1 ..] diff --git a/data/examples/declaration/value/function/arrow/proc-applications-out.hs b/data/examples/declaration/value/function/arrow/proc-applications-out.hs index 7745447..04c4522 100644 --- a/data/examples/declaration/value/function/arrow/proc-applications-out.hs +++ b/data/examples/declaration/value/function/arrow/proc-applications-out.hs @@ -4,16 +4,16 @@ foo x = proc a -> a -< x bar f x = proc - ( y, - z, - w + ( y + , z + , w ) -> f -- The value -< - ( x, -- Foo - w, -- Bar - z -- Baz + ( x -- Foo + , w -- Bar + , z -- Baz ) baz x = proc a -> a -<< x diff --git a/data/examples/declaration/value/function/arrow/proc-cases-out.hs b/data/examples/declaration/value/function/arrow/proc-cases-out.hs index 394c18b..fb15778 100644 --- a/data/examples/declaration/value/function/arrow/proc-cases-out.hs +++ b/data/examples/declaration/value/function/arrow/proc-cases-out.hs @@ -5,8 +5,8 @@ foo f = proc a -> case a of Left b -> f -< b bar f g h j = proc a -> case a of Left - ( (a, b), - (c, d) + ( (a, b) + , (c, d) ) -> f (a <> c) -< b <> d Right (Left a) -> diff --git a/data/examples/declaration/value/function/arrow/proc-do-complex-out.hs b/data/examples/declaration/value/function/arrow/proc-do-complex-out.hs index eaaa562..5cfb36c 100644 --- a/data/examples/declaration/value/function/arrow/proc-do-complex-out.hs +++ b/data/examples/declaration/value/function/arrow/proc-do-complex-out.hs @@ -6,29 +6,29 @@ foo h ma = proc - ( (a, b), - (c, d), - (e, f) + ( (a, b) + , (c, d) + , (e, f) ) -> do -- Begin do (x, y) <- -- GHC parser fails if layed out over multiple lines f -- Call into f - ( a, - c -- Tuple together arguments + ( a + , c -- Tuple together arguments ) - ( b, - d + ( b + , d ) -< - ( b + 1, -- Funnel into arrow - d * b + ( b + 1 -- Funnel into arrow + , d * b ) if x `mod` y == 0 -- Basic condition then case e of -- Only left case is relevant Left - ( z, - w + ( z + , w ) -> \u -> -- Procs can have lambdas let v = u -- Actually never used diff --git a/data/examples/declaration/value/function/arrow/proc-do-simple2-out.hs b/data/examples/declaration/value/function/arrow/proc-do-simple2-out.hs index e35a613..385e996 100644 --- a/data/examples/declaration/value/function/arrow/proc-do-simple2-out.hs +++ b/data/examples/declaration/value/function/arrow/proc-do-simple2-out.hs @@ -13,9 +13,9 @@ bazbaz f g h = proc (a, b, c) -> do x y -< - ( a, - b, - c + ( a + , b + , c ) returnA -< diff --git a/data/examples/declaration/value/function/arrow/recursive-procs-out.hs b/data/examples/declaration/value/function/arrow/recursive-procs-out.hs index 5a04daa..177bcee 100644 --- a/data/examples/declaration/value/function/arrow/recursive-procs-out.hs +++ b/data/examples/declaration/value/function/arrow/recursive-procs-out.hs @@ -8,8 +8,8 @@ foo f g = proc (x, y) -> do y bar -< - ( a, - b + ( a + , b ) rec p <- f diff --git a/data/examples/declaration/value/function/complex-list-out.hs b/data/examples/declaration/value/function/complex-list-out.hs index 468bfba..bb10abf 100644 --- a/data/examples/declaration/value/function/complex-list-out.hs +++ b/data/examples/declaration/value/function/complex-list-out.hs @@ -1,15 +1,15 @@ handleStuff = handle [ \ExceptionA -> - something, - \ExceptionB -> + something + , \ExceptionB -> somethingElse ] handleStuff = handle [ foo - bar, - baz + bar + , baz qux ] diff --git a/data/examples/declaration/value/function/comprehension/transform-multi-line1-out.hs b/data/examples/declaration/value/function/comprehension/transform-multi-line1-out.hs index d38ce0d..d77ecbb 100644 --- a/data/examples/declaration/value/function/comprehension/transform-multi-line1-out.hs +++ b/data/examples/declaration/value/function/comprehension/transform-multi-line1-out.hs @@ -1,12 +1,12 @@ {-# LANGUAGE TransformListComp #-} foo' xs ys = - [ ( x, - y + [ ( x + , y ) - | x <- xs, - y <- ys, - then - -- First comment - reverse -- Second comment + | x <- xs + , y <- ys + , then + -- First comment + reverse -- Second comment ] diff --git a/data/examples/declaration/value/function/comprehension/transform-multi-line2-out.hs b/data/examples/declaration/value/function/comprehension/transform-multi-line2-out.hs index 0c0dff8..d378beb 100644 --- a/data/examples/declaration/value/function/comprehension/transform-multi-line2-out.hs +++ b/data/examples/declaration/value/function/comprehension/transform-multi-line2-out.hs @@ -1,16 +1,16 @@ {-# LANGUAGE TransformListComp #-} bar' xs ys = - [ ( x, - y + [ ( x + , y ) - | x <- xs, - y <- ys, - then - -- First comment - sortWith - by - ( x - + y -- Second comment - ) + | x <- xs + , y <- ys + , then + -- First comment + sortWith + by + ( x + + y -- Second comment + ) ] diff --git a/data/examples/declaration/value/function/comprehension/transform-multi-line3-out.hs b/data/examples/declaration/value/function/comprehension/transform-multi-line3-out.hs index ac51b17..4b0c152 100644 --- a/data/examples/declaration/value/function/comprehension/transform-multi-line3-out.hs +++ b/data/examples/declaration/value/function/comprehension/transform-multi-line3-out.hs @@ -1,12 +1,12 @@ {-# LANGUAGE TransformListComp #-} baz' xs ys = - [ ( x, - y + [ ( x + , y ) - | x <- xs, - y <- ys, - then group using - -- First comment - permutations -- Second comment + | x <- xs + , y <- ys + , then group using + -- First comment + permutations -- Second comment ] diff --git a/data/examples/declaration/value/function/comprehension/transform-multi-line4-out.hs b/data/examples/declaration/value/function/comprehension/transform-multi-line4-out.hs index a79bace..88d1327 100644 --- a/data/examples/declaration/value/function/comprehension/transform-multi-line4-out.hs +++ b/data/examples/declaration/value/function/comprehension/transform-multi-line4-out.hs @@ -1,17 +1,17 @@ {-# LANGUAGE TransformListComp #-} quux' xs ys = - [ ( x, - y + [ ( x + , y ) - | x <- xs, - y <- ys, - then group by - -- First comment - ( x - + y - ) - using - -- Second comment - groupWith -- Third comment + | x <- xs + , y <- ys + , then group by + -- First comment + ( x + + y + ) + using + -- Second comment + groupWith -- Third comment ] diff --git a/data/examples/declaration/value/function/fancy-forall-0-out.hs b/data/examples/declaration/value/function/fancy-forall-0-out.hs index 0539703..aa91cfc 100644 --- a/data/examples/declaration/value/function/fancy-forall-0-out.hs +++ b/data/examples/declaration/value/function/fancy-forall-0-out.hs @@ -1,10 +1,10 @@ wrapError :: forall outertag innertag t outer inner m a. - ( forall x. Coercible (t m x) (m x), - forall m'. + ( forall x. Coercible (t m x) (m x) + , forall m'. HasCatch outertag outer m' => - HasCatch innertag inner (t m'), - HasCatch outertag outer m + HasCatch innertag inner (t m') + , HasCatch outertag outer m ) => (forall m'. HasCatch innertag inner m' => m' a) -> m a diff --git a/data/examples/declaration/value/function/fancy-forall-1-out.hs b/data/examples/declaration/value/function/fancy-forall-1-out.hs index 1047205..e2673fd 100644 --- a/data/examples/declaration/value/function/fancy-forall-1-out.hs +++ b/data/examples/declaration/value/function/fancy-forall-1-out.hs @@ -1,10 +1,10 @@ magnify :: forall outertag innertag t outer inner m a. - ( forall x. Coercible (t m x) (m x), - forall m'. + ( forall x. Coercible (t m x) (m x) + , forall m'. HasReader outertag outer m' => - HasReader innertag inner (t m'), - HasReader outertag outer m + HasReader innertag inner (t m') + , HasReader outertag outer m ) => (forall m'. HasReader innertag inner m' => m' a) -> m a diff --git a/data/examples/declaration/value/function/implicit-params-out.hs b/data/examples/declaration/value/function/implicit-params-out.hs index acb7976..96dff06 100644 --- a/data/examples/declaration/value/function/implicit-params-out.hs +++ b/data/examples/declaration/value/function/implicit-params-out.hs @@ -8,8 +8,8 @@ sort = sortBy ?cmp sort' :: ( ?cmp :: - a -> a -> Bool, - ?foo :: Int + a -> a -> Bool + , ?foo :: Int ) => [a] -> [a] diff --git a/data/examples/declaration/value/function/list-comprehensions-out.hs b/data/examples/declaration/value/function/list-comprehensions-out.hs index 6173a21..2ce3f32 100644 --- a/data/examples/declaration/value/function/list-comprehensions-out.hs +++ b/data/examples/declaration/value/function/list-comprehensions-out.hs @@ -4,21 +4,21 @@ bar x y = [(a, b) | a <- x, even a, b <- y, a != b] barbaz x y z w = [ (a, b, c, d) -- Foo - | a <- - x, -- Bar - b <- y, -- Baz - any even [a, b], - c <- - z - * z ^ 2, -- Bar baz - d <- - w - + w, -- Baz bar - all - even - [ a, - b, - c, - d - ] + | a <- + x -- Bar + , b <- y -- Baz + , any even [a, b] + , c <- + z + * z ^ 2 -- Bar baz + , d <- + w + + w -- Baz bar + , all + even + [ a + , b + , c + , d + ] ] diff --git a/data/examples/declaration/value/function/parallel-comprehensions-complex-out.hs b/data/examples/declaration/value/function/parallel-comprehensions-complex-out.hs index 1f03620..dd1d88f 100644 --- a/data/examples/declaration/value/function/parallel-comprehensions-complex-out.hs +++ b/data/examples/declaration/value/function/parallel-comprehensions-complex-out.hs @@ -1,35 +1,35 @@ baz x y z w = - [ ( a, - b, - c, - d, - e, - f, - g, - h, - i, - j + [ ( a + , b + , c + , d + , e + , f + , g + , h + , i + , j ) - | a <- -- Foo 1 - x, -- Foo 2 - b <- -- Bar 1 - y, -- Bar 2 + | a <- -- Foo 1 + x -- Foo 2 + , b <- -- Bar 1 + y -- Bar 2 + , a + `mod` b -- Value + == 0 + | c <- -- Baz 1 + z + * z -- Baz 2 + -- Baz 3 + | d <- w -- Other + | e <- x * x -- Foo bar + | f <- -- Foo baz 1 + y + y -- Foo baz 2 + | h <- z + z * w ^ 2 -- Bar foo + | i <- -- Bar bar 1 a - `mod` b -- Value - == 0 - | c <- -- Baz 1 - z - * z -- Baz 2 - -- Baz 3 - | d <- w -- Other - | e <- x * x -- Foo bar - | f <- -- Foo baz 1 - y + y -- Foo baz 2 - | h <- z + z * w ^ 2 -- Bar foo - | i <- -- Bar bar 1 - a - + b, -- Bar bar 2 - -- Bar bar 3 - j <- -- Bar baz 1 - a + b -- Bar baz 2 + + b -- Bar bar 2 + -- Bar bar 3 + , j <- -- Bar baz 1 + a + b -- Bar baz 2 ] diff --git a/data/examples/declaration/value/function/pattern/multiline-case-pattern-out.hs b/data/examples/declaration/value/function/pattern/multiline-case-pattern-out.hs index be80389..9f6da58 100644 --- a/data/examples/declaration/value/function/pattern/multiline-case-pattern-out.hs +++ b/data/examples/declaration/value/function/pattern/multiline-case-pattern-out.hs @@ -1,12 +1,12 @@ readerBench doc name = runPure $ case (getReader name, getWriter name) of - ( Right (TextReader r, rexts), - Right (TextWriter w, wexts) + ( Right (TextReader r, rexts) + , Right (TextWriter w, wexts) ) -> undefined f xs = case xs of - [ a, - b + [ a + , b ] -> a + b g xs = case xs of diff --git a/data/examples/declaration/value/function/pattern/record-patterns-out.hs b/data/examples/declaration/value/function/pattern/record-patterns-out.hs index d596323..eae0918 100644 --- a/data/examples/declaration/value/function/pattern/record-patterns-out.hs +++ b/data/examples/declaration/value/function/pattern/record-patterns-out.hs @@ -13,7 +13,7 @@ baz Boom {boom = b, ..} = b quux :: Boom -> Int quux Boom - { boom = a, - foom = b, - .. + { boom = a + , foom = b + , .. } = a + b diff --git a/data/examples/declaration/value/function/record/constructors-out.hs b/data/examples/declaration/value/function/record/constructors-out.hs index b1d4d82..5261b3e 100644 --- a/data/examples/declaration/value/function/record/constructors-out.hs +++ b/data/examples/declaration/value/function/record/constructors-out.hs @@ -2,8 +2,8 @@ foo = Foo {a = 3} bar = Bar - { abc = foo, - def = Foo {a = 10} + { abc = foo + , def = Foo {a = 10} } baz = Baz {} @@ -12,20 +12,20 @@ sym = Foo {(+) = 3} aLongVariableName = ALongRecordName - { short = baz, - aLongRecordFieldName = + { short = baz + , aLongRecordFieldName = YetAnotherLongRecordName { yetAnotherLongRecordFieldName = "a long string" - }, - aLongRecordFieldName2 = + } + , aLongRecordFieldName2 = Just YetAnotherLongRecordName - { yetAnotherLongRecordFieldName = "a long string", - yetAnotherLongRecordFieldName = + { yetAnotherLongRecordFieldName = "a long string" + , yetAnotherLongRecordFieldName = Just "a long string" - }, - aLongRecordFieldName3 = do + } + , aLongRecordFieldName3 = do foo bar } diff --git a/data/examples/declaration/value/function/record/updaters-out.hs b/data/examples/declaration/value/function/record/updaters-out.hs index fbed944..937c07e 100644 --- a/data/examples/declaration/value/function/record/updaters-out.hs +++ b/data/examples/declaration/value/function/record/updaters-out.hs @@ -2,8 +2,8 @@ foo x = x {a = 3} bar x = x - { abc = foo, - def = Foo {a = 10} + { abc = foo + , def = Foo {a = 10} } baz x = x {} diff --git a/data/examples/declaration/value/function/record/wildcards-out.hs b/data/examples/declaration/value/function/record/wildcards-out.hs index ed00142..aa9bdbe 100644 --- a/data/examples/declaration/value/function/record/wildcards-out.hs +++ b/data/examples/declaration/value/function/record/wildcards-out.hs @@ -5,10 +5,10 @@ foo x y = Foo {x, y} bar x y z = Bar - { x, - y, - z, - .. + { x + , y + , z + , .. } baz = Baz {..} diff --git a/data/examples/declaration/value/function/static-pointers-out.hs b/data/examples/declaration/value/function/static-pointers-out.hs index 8fad7ce..3d9658a 100644 --- a/data/examples/declaration/value/function/static-pointers-out.hs +++ b/data/examples/declaration/value/function/static-pointers-out.hs @@ -6,9 +6,9 @@ foo = static 5 bar :: StaticPtr [Int] bar = static - [ 1, - 2, - 3 + [ 1 + , 2 + , 3 ] baz :: StaticPtr Bool diff --git a/data/examples/declaration/value/function/tuples-out.hs b/data/examples/declaration/value/function/tuples-out.hs index 2b6abc5..63d0836 100644 --- a/data/examples/declaration/value/function/tuples-out.hs +++ b/data/examples/declaration/value/function/tuples-out.hs @@ -1,14 +1,14 @@ foo = (1, 2, 3) bar = - ( 1, - 2, - 3 + ( 1 + , 2 + , 3 ) handleStuff = ( let foo = foo - in foo, - let bar = bar + in foo + , let bar = bar in bar ) diff --git a/data/examples/declaration/value/function/unboxed-tuples-out.hs b/data/examples/declaration/value/function/unboxed-tuples-out.hs index 65bfc61..a1395d9 100644 --- a/data/examples/declaration/value/function/unboxed-tuples-out.hs +++ b/data/examples/declaration/value/function/unboxed-tuples-out.hs @@ -4,7 +4,7 @@ foo = (# 1, 2, 3 #) bar = (# - 1, - 2, - 3 + 1 + , 2 + , 3 #) diff --git a/data/examples/declaration/value/other/comments-get-before-op-out.hs b/data/examples/declaration/value/other/comments-get-before-op-out.hs index 51e6d04..efc1a63 100644 --- a/data/examples/declaration/value/other/comments-get-before-op-out.hs +++ b/data/examples/declaration/value/other/comments-get-before-op-out.hs @@ -1,10 +1,10 @@ main :: IO () main = do migrateSchema - [ migration1, - migration1, - migration3 - -- When adding migrations here, don't forget to update - -- 'schemaVersion' in Galley.Data + [ migration1 + , migration1 + , migration3 + -- When adding migrations here, don't forget to update + -- 'schemaVersion' in Galley.Data ] `finally` Log.close diff --git a/data/examples/declaration/value/other/line-multi-line-out.hs b/data/examples/declaration/value/other/line-multi-line-out.hs index 9a77c1a..0f94794 100644 --- a/data/examples/declaration/value/other/line-multi-line-out.hs +++ b/data/examples/declaration/value/other/line-multi-line-out.hs @@ -1,6 +1,6 @@ x :: [Int] x = - [ 1, - 2, - somethingSomething 3 + [ 1 + , 2 + , somethingSomething 3 ] diff --git a/data/examples/declaration/value/pattern-synonyms/bidirectional-out.hs b/data/examples/declaration/value/pattern-synonyms/bidirectional-out.hs index 21d4aac..58d4e09 100644 --- a/data/examples/declaration/value/pattern-synonyms/bidirectional-out.hs +++ b/data/examples/declaration/value/pattern-synonyms/bidirectional-out.hs @@ -6,8 +6,8 @@ pattern Arrow t1 t2 = App "->" [t1, t2] pattern Arrow {t1, t2} = App "->" [t1, t2] pattern Arrow - { t1, - t2 + { t1 + , t2 } = App "->" [t1, t2] diff --git a/data/examples/declaration/value/pattern-synonyms/unidirectional-out.hs b/data/examples/declaration/value/pattern-synonyms/unidirectional-out.hs index d339bfd..7cb2450 100644 --- a/data/examples/declaration/value/pattern-synonyms/unidirectional-out.hs +++ b/data/examples/declaration/value/pattern-synonyms/unidirectional-out.hs @@ -12,8 +12,8 @@ pattern FirstTwo {x, y} <- x : (y : xs) pattern FirstTwo' - { x, - y + { x + , y } <- x : (y : xs) diff --git a/data/examples/declaration/warning/warning-multiline-out.hs b/data/examples/declaration/warning/warning-multiline-out.hs index 9b32f06..ce33dc0 100644 --- a/data/examples/declaration/warning/warning-multiline-out.hs +++ b/data/examples/declaration/warning/warning-multiline-out.hs @@ -1,8 +1,8 @@ {-# WARNING - test, - foo - [ "These are bad functions", - "Really bad!" + test + , foo + [ "These are bad functions" + , "Really bad!" ] #-} test :: IO () diff --git a/data/examples/import/explicit-imports-out.hs b/data/examples/import/explicit-imports-out.hs index 68e200a..61d993a 100644 --- a/data/examples/import/explicit-imports-out.hs +++ b/data/examples/import/explicit-imports-out.hs @@ -1,12 +1,12 @@ import qualified MegaModule as M - ( Either, - Maybe (Just, Nothing), - MaybeT (..), - Monad (return, (>>), (>>=)), - MonadBaseControl, - join, - liftIO, - void, - (<<<), - (>>>), + ( Either + , Maybe (Just, Nothing) + , MaybeT (..) + , Monad (return, (>>), (>>=)) + , MonadBaseControl + , join + , liftIO + , void + , (<<<) + , (>>>) ) diff --git a/data/examples/import/explicit-imports-with-comments-out.hs b/data/examples/import/explicit-imports-with-comments-out.hs index b04b1a2..277e67f 100644 --- a/data/examples/import/explicit-imports-with-comments-out.hs +++ b/data/examples/import/explicit-imports-with-comments-out.hs @@ -1,7 +1,7 @@ import qualified MegaModule as M ( -- (1) -- (2) - Either, -- (3) - (<<<), - (>>>), + Either -- (3) + , (<<<) + , (>>>) ) diff --git a/data/examples/import/misc-out.hs b/data/examples/import/misc-out.hs index 2ceb09e..34e8e2a 100644 --- a/data/examples/import/misc-out.hs +++ b/data/examples/import/misc-out.hs @@ -1,5 +1,5 @@ import A hiding - ( foobarbazqux, + ( foobarbazqux ) import {-# SOURCE #-} safe qualified Module as M hiding (a, b, c, d, e, f) import Name hiding () diff --git a/data/examples/import/nested-explicit-imports-out.hs b/data/examples/import/nested-explicit-imports-out.hs index c3af3c0..824ea97 100644 --- a/data/examples/import/nested-explicit-imports-out.hs +++ b/data/examples/import/nested-explicit-imports-out.hs @@ -1,10 +1,10 @@ import qualified MegaModule as M - ( Either, - Monad - ( return, - (>>), - (>>=) - ), - (<<<), - (>>>), + ( Either + , Monad + ( return + , (>>) + , (>>=) + ) + , (<<<) + , (>>>) ) diff --git a/data/examples/module-header/multiline-out.hs b/data/examples/module-header/multiline-out.hs index fa155d9..40da39d 100644 --- a/data/examples/module-header/multiline-out.hs +++ b/data/examples/module-header/multiline-out.hs @@ -1,6 +1,6 @@ module Foo - ( foo, - bar, - baz, + ( foo + , bar + , baz ) where diff --git a/data/examples/module-header/multiline-with-comments-out.hs b/data/examples/module-header/multiline-with-comments-out.hs index 0e7d315..dafc6e1 100644 --- a/data/examples/module-header/multiline-with-comments-out.hs +++ b/data/examples/module-header/multiline-with-comments-out.hs @@ -4,18 +4,18 @@ -- | Header. module My.Module ( -- * Something - foo, - bar, + foo + , bar -- * Another thing - (), - {- some other thing -} foo2, -- yet another - foo3, -- third one - baz, - bar2, -- a multiline comment - -- the second line - bar3, - module Foo.Bar.Baz, + , () + , {- some other thing -} foo2 -- yet another + , foo3 -- third one + , baz + , bar2 -- a multiline comment + -- the second line + , bar3 + , module Foo.Bar.Baz ) where diff --git a/data/examples/module-header/multiline2-out.hs b/data/examples/module-header/multiline2-out.hs index fa155d9..40da39d 100644 --- a/data/examples/module-header/multiline2-out.hs +++ b/data/examples/module-header/multiline2-out.hs @@ -1,6 +1,6 @@ module Foo - ( foo, - bar, - baz, + ( foo + , bar + , baz ) where diff --git a/data/examples/module-header/named-section-out.hs b/data/examples/module-header/named-section-out.hs index 8f1b724..0f53c74 100644 --- a/data/examples/module-header/named-section-out.hs +++ b/data/examples/module-header/named-section-out.hs @@ -3,8 +3,8 @@ module Magic -- $explanation -- ** Another level - foo, - bar, + foo + , bar ) where diff --git a/data/examples/module-header/warning-pragma-list-multiline-out.hs b/data/examples/module-header/warning-pragma-list-multiline-out.hs index eff0513..c10f0f1 100644 --- a/data/examples/module-header/warning-pragma-list-multiline-out.hs +++ b/data/examples/module-header/warning-pragma-list-multiline-out.hs @@ -1,11 +1,11 @@ module Test {-# DEPRECATED - [ "This module is deprecated.", - "Please use OtherModule instead." + [ "This module is deprecated." + , "Please use OtherModule instead." ] #-} - ( foo, - bar, - baz, + ( foo + , bar + , baz ) where diff --git a/data/examples/other/comment-inside-construct-out.hs b/data/examples/other/comment-inside-construct-out.hs index 96e1bed..dac7204 100644 --- a/data/examples/other/comment-inside-construct-out.hs +++ b/data/examples/other/comment-inside-construct-out.hs @@ -1,8 +1,8 @@ xs = - [ outer list item, - [ inner list first item, - inner list second item - -- inner list last item commented - ], - outer list item + [ outer list item + , [ inner list first item + , inner list second item + -- inner list last item commented + ] + , outer list item ] diff --git a/data/examples/other/cpp/shifted-out.hs b/data/examples/other/cpp/shifted-out.hs index a0e47c8..db54196 100644 --- a/data/examples/other/cpp/shifted-out.hs +++ b/data/examples/other/cpp/shifted-out.hs @@ -15,7 +15,7 @@ sinkData h compression = do #endif return DataDescriptor - { ddCRC32 = fromIntegral crc32, - ddCompressedSize = compressedSize, - ddUncompressedSize = uncompressedSize + { ddCRC32 = fromIntegral crc32 + , ddCompressedSize = compressedSize + , ddUncompressedSize = uncompressedSize } diff --git a/data/examples/other/merging-comments-out.hs b/data/examples/other/merging-comments-out.hs index 6277019..dab1dc9 100644 --- a/data/examples/other/merging-comments-out.hs +++ b/data/examples/other/merging-comments-out.hs @@ -2,9 +2,9 @@ foo xs = baz where bar = catMaybes - [ lookup langKey gets, -- 1 - lookup langKey cookies, -- 2 - lookupText langKey session -- 3 + [ lookup langKey gets -- 1 + , lookup langKey cookies -- 2 + , lookupText langKey session -- 3 ] ++ xs -- 4 diff --git a/data/examples/other/pragma-sorting-out.hs b/data/examples/other/pragma-sorting-out.hs index 0d007d7..b265a40 100644 --- a/data/examples/other/pragma-sorting-out.hs +++ b/data/examples/other/pragma-sorting-out.hs @@ -6,6 +6,6 @@ {-# LANGUAGE NoMonoLocalBinds #-} module Foo - ( bar, + ( bar ) where diff --git a/region-tests/expected-result-all.hs b/region-tests/expected-result-all.hs index 65b2f01..1193348 100644 --- a/region-tests/expected-result-all.hs +++ b/region-tests/expected-result-all.hs @@ -1,9 +1,9 @@ {-# LANGUAGE LambdaCase #-} module Foo - ( foo, - bar, - baz, + ( foo + , bar + , baz ) where diff --git a/src/Ormolu/Printer/Combinators.hs b/src/Ormolu/Printer/Combinators.hs index 00536b2..a3c7f58 100644 --- a/src/Ormolu/Printer/Combinators.hs +++ b/src/Ormolu/Printer/Combinators.hs @@ -294,9 +294,13 @@ brackets_ needBreaks open close style m = sitcc (vlayout singleLine multiLine) txt close multiLine = do txt open - if needBreaks - then newline >> inci m - else space >> sitcc m + let inci' = + if (style == S) || needBreaks + then inci + else id + inci' $ if needBreaks + then newline >> m + else space >> m newline inciIf (style == S) (txt close) @@ -309,7 +313,7 @@ comma = txt "," -- | Delimiting combination with 'comma'. To be used with 'sep'. commaDel :: R () -commaDel = comma >> breakpoint +commaDel = breakpoint' >> comma >> space -- | Print @=@. Do not use @'txt' "="@. equals :: R () diff --git a/src/Ormolu/Printer/Meat/Common.hs b/src/Ormolu/Printer/Meat/Common.hs index 5b7aac1..ee8f233 100644 --- a/src/Ormolu/Printer/Meat/Common.hs +++ b/src/Ormolu/Printer/Meat/Common.hs @@ -127,7 +127,7 @@ p_infixDefHelper isInfix indentArgs name args = let parens' = if null ps then id - else parens N + else parens N . sitcc parens' $ do p0 breakpoint diff --git a/src/Ormolu/Printer/Meat/Declaration/Class.hs b/src/Ormolu/Printer/Meat/Declaration/Class.hs index e91b6c8..ddd9af8 100644 --- a/src/Ormolu/Printer/Meat/Declaration/Class.hs +++ b/src/Ormolu/Printer/Meat/Declaration/Class.hs @@ -82,7 +82,7 @@ p_classFundeps fdeps = unless (null fdeps) $ do breakpoint txt "|" space - inci $ sep commaDel (sitcc . located' p_funDep) fdeps + sep commaDel (sitcc . located' p_funDep) fdeps p_funDep :: FunDep (Located RdrName) -> R () p_funDep (before, after) = do diff --git a/src/Ormolu/Printer/Meat/Declaration/Rule.hs b/src/Ormolu/Printer/Meat/Declaration/Rule.hs index 12a648a..40bde58 100644 --- a/src/Ormolu/Printer/Meat/Declaration/Rule.hs +++ b/src/Ormolu/Printer/Meat/Declaration/Rule.hs @@ -55,7 +55,7 @@ p_ruleName (_, name) = atom $ (HsString NoSourceText name :: HsLit GhcPs) p_ruleBndr :: RuleBndr GhcPs -> R () p_ruleBndr = \case RuleBndr NoExtField x -> p_rdrName x - RuleBndrSig NoExtField x hswc -> parens N $ do + RuleBndrSig NoExtField x hswc -> parens N . sitcc $ do p_rdrName x p_typeAscription hswc XRuleBndr x -> noExtCon x diff --git a/src/Ormolu/Printer/Meat/Declaration/Value.hs b/src/Ormolu/Printer/Meat/Declaration/Value.hs index 18c4cef..baa755e 100644 --- a/src/Ormolu/Printer/Meat/Declaration/Value.hs +++ b/src/Ormolu/Printer/Meat/Declaration/Value.hs @@ -333,7 +333,7 @@ p_hsCmd = \case -- does. Open an issue and ping @yumiova if this ever occurs in output. notImplemented "HsCmdApp" HsCmdLam NoExtField mgroup -> p_matchGroup' cmdPlacement p_hsCmd Lambda mgroup - HsCmdPar NoExtField c -> parens N (located c p_hsCmd) + HsCmdPar NoExtField c -> parens N (sitcc $ located c p_hsCmd) HsCmdCase NoExtField e mgroup -> p_case cmdPlacement p_hsCmd e mgroup HsCmdIf NoExtField _ if' then' else' -> @@ -627,7 +627,7 @@ p_hsExpr' s = \case space located e p_hsExpr HsPar NoExtField e -> - parens s (located e (dontUseBraces . p_hsExpr)) + parens s (sitcc $ located e (dontUseBraces . p_hsExpr)) SectionL NoExtField x op -> do located x p_hsExpr breakpoint @@ -686,10 +686,9 @@ p_hsExpr' s = \case (breakpoint >> txt "|" >> space) p_seqBody p_seqBody = - sitcc - . sep - commaDel - (located' (sitcc . p_stmt)) + sep + commaDel + (located' (sitcc . p_stmt)) stmts = init xs yield = last xs lists = foldr (liftAppend . gatherStmt) [] stmts @@ -948,7 +947,7 @@ p_pat = \case txt "@" located pat p_pat ParPat NoExtField pat -> - located pat (parens S . p_pat) + located pat (parens S . sitcc . p_pat) BangPat NoExtField pat -> do txt "!" located pat p_pat diff --git a/src/Ormolu/Printer/Meat/ImportExport.hs b/src/Ormolu/Printer/Meat/ImportExport.hs index 3dbdcc5..4344783 100644 --- a/src/Ormolu/Printer/Meat/ImportExport.hs +++ b/src/Ormolu/Printer/Meat/ImportExport.hs @@ -13,7 +13,6 @@ import Control.Monad import GHC import Ormolu.Printer.Combinators import Ormolu.Printer.Meat.Common -import Ormolu.Utils (RelativePos (..), attachRelativePos) p_hsmodExports :: [LIE GhcPs] -> R () p_hsmodExports [] = do @@ -21,12 +20,7 @@ p_hsmodExports [] = do breakpoint' txt ")" p_hsmodExports xs = - parens N $ do - layout <- getLayout - sep - breakpoint - (\(p, l) -> sitcc (located l (p_lie layout p))) - (attachRelativePos xs) + parens N (p_lies xs) p_hsmodImport :: Bool -> ImportDecl GhcPs -> R () p_hsmodImport useQualifiedPost ImportDecl {..} = do @@ -65,28 +59,32 @@ p_hsmodImport useQualifiedPost ImportDecl {..} = do Nothing -> return () Just (_, L _ xs) -> do breakpoint - parens N $ do - layout <- getLayout - sep - breakpoint - (\(p, l) -> sitcc (located l (p_lie layout p))) - (attachRelativePos xs) + parens N (p_lies xs) newline p_hsmodImport _ (XImportDecl x) = noExtCon x -p_lie :: Layout -> RelativePos -> IE GhcPs -> R () -p_lie encLayout relativePos = \case - IEVar NoExtField l1 -> do +p_lies :: [LIE GhcPs] -> R () +p_lies = go True True + where + go _ _ [] = return () + go isFirstElement isFirstItem (x:xs)= do + let thisIsItem = isIEItem (unLoc x) + when (thisIsItem && not isFirstItem) $ + comma >> space + inci $ located x (p_lie isFirstElement) + unless (null xs) breakpoint' + go False (if thisIsItem then False else isFirstItem) xs + +p_lie :: Bool -> IE GhcPs -> R () +p_lie isFirstElement = \case + IEVar NoExtField l1 -> located l1 p_ieWrappedName - p_comma - IEThingAbs NoExtField l1 -> do + IEThingAbs NoExtField l1 -> located l1 p_ieWrappedName - p_comma IEThingAll NoExtField l1 -> do located l1 p_ieWrappedName space txt "(..)" - p_comma IEThingWith NoExtField l1 w xs _ -> sitcc $ do located l1 p_ieWrappedName breakpoint @@ -99,28 +97,21 @@ p_lie encLayout relativePos = \case IEWildcard n -> let (before, after) = splitAt n names in before ++ [txt ".."] ++ after - p_comma - IEModuleContents NoExtField l1 -> do + IEModuleContents NoExtField l1 -> located l1 p_hsmodName - p_comma IEGroup NoExtField n str -> do - case relativePos of - SinglePos -> return () - FirstPos -> return () - MiddlePos -> newline - LastPos -> newline + unless isFirstElement (newline >> newline) p_hsDocString (Asterisk n) False (noLoc str) IEDoc NoExtField str -> p_hsDocString Pipe False (noLoc str) IEDocNamed NoExtField str -> p_hsDocName str XIE x -> noExtCon x - where - p_comma = - case encLayout of - SingleLine -> - case relativePos of - SinglePos -> return () - FirstPos -> comma - MiddlePos -> comma - LastPos -> return () - MultiLine -> comma + +isIEItem :: IE GhcPs -> Bool +isIEItem = \case + IEVar {} -> True + IEThingAbs {} -> True + IEThingAll {} -> True + IEThingWith {} -> True + IEModuleContents {} -> True + _ -> False diff --git a/src/Ormolu/Printer/Meat/Type.hs b/src/Ormolu/Printer/Meat/Type.hs index dbe7e6b..ffecaf1 100644 --- a/src/Ormolu/Printer/Meat/Type.hs +++ b/src/Ormolu/Printer/Meat/Type.hs @@ -107,7 +107,7 @@ p_hsType' multilineArgs docStyle = \case let opTree = OpBranch (tyOpTree x) op (tyOpTree y) in p_tyOpTree (reassociateOpTree Just opTree) HsParTy NoExtField t -> - parens N (located t p_hsType) + parens N (sitcc $ located t p_hsType) HsIParamTy NoExtField n t -> sitcc $ do located n atom space @@ -198,7 +198,7 @@ p_hsTyVarBndr :: HsTyVarBndr GhcPs -> R () p_hsTyVarBndr = \case UserTyVar NoExtField x -> p_rdrName x - KindedTyVar NoExtField l k -> parens N $ do + KindedTyVar NoExtField l k -> parens N . sitcc $ do located l atom space txt "::"