File tree 2 files changed +21
-1
lines changed
lib/Language/Haskell/Stylish/Step
tests/Language/Haskell/Stylish/Step/Data 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ import GHC.Hs.Types (ConDeclField (..),
38
38
HsConDetails (.. ), HsContext ,
39
39
HsImplicitBndrs (.. ),
40
40
HsTyVarBndr (.. ),
41
- HsType (.. ), LHsQTyVars (.. ))
41
+ HsType (.. ), LHsQTyVars (.. ), LHsKind )
42
42
import RdrName (RdrName )
43
43
import SrcLoc (GenLocated (.. ), Located ,
44
44
RealLocated )
@@ -312,9 +312,11 @@ putName decl@MkDataDecl{..} =
312
312
putRdrName dataDeclName
313
313
space
314
314
forM_ secondTvar putOutputable
315
+ maybePutKindSig
315
316
else do
316
317
putRdrName dataDeclName
317
318
forM_ (hsq_explicit dataTypeVars) (\ t -> space >> putOutputable t)
319
+ maybePutKindSig
318
320
319
321
where
320
322
firstTvar :: Maybe (Located (HsTyVarBndr GhcPs ))
@@ -330,6 +332,12 @@ putName decl@MkDataDecl{..} =
330
332
& drop 1
331
333
& listToMaybe
332
334
335
+ maybePutKindSig :: Printer ()
336
+ maybePutKindSig = forM_ maybeKindSig (\ k -> space >> putText " ::" >> space >> putOutputable k)
337
+
338
+ maybeKindSig :: Maybe (LHsKind GhcPs )
339
+ maybeKindSig = dd_kindSig dataDefn
340
+
333
341
putConstructor :: Config -> Int -> Located (ConDecl GhcPs ) -> P ()
334
342
putConstructor cfg consIndent (L _ cons) = case cons of
335
343
ConDeclGADT {.. } -> do
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ tests = testGroup "Language.Haskell.Stylish.Step.Data.Tests"
75
75
, testCase " case 60" case60
76
76
, testCase " case 61 (issue 282)" case61
77
77
, testCase " case 62 (issue 273)" case62
78
+ , testCase " case 63 (issue 338)" case63
78
79
]
79
80
80
81
case00 :: Assertion
@@ -1377,6 +1378,17 @@ case62 = expected @=? testStep (step sameIndentStyle) input
1377
1378
, " }"
1378
1379
]
1379
1380
1381
+ case63 :: Assertion
1382
+ case63 = expected @=? testStep (step indentIndentStyle) input
1383
+ where
1384
+ input = unlines
1385
+ [ " module Herp where"
1386
+ , " "
1387
+ , " data Foo :: * -> * where"
1388
+ , " Bar :: () -> Foo ()"
1389
+ ]
1390
+ expected = input
1391
+
1380
1392
sameSameStyle :: Config
1381
1393
sameSameStyle = Config SameLine SameLine 2 2 False True SameLine False True NoMaxColumns
1382
1394
You can’t perform that action at this time.
0 commit comments