File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
lib/Language/Haskell/Stylish/Step
tests/Language/Haskell/Stylish/Step/Data Expand file tree Collapse file tree 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 (..),
3838 HsConDetails (.. ), HsContext ,
3939 HsImplicitBndrs (.. ),
4040 HsTyVarBndr (.. ),
41- HsType (.. ), LHsQTyVars (.. ))
41+ HsType (.. ), LHsQTyVars (.. ), LHsKind )
4242import RdrName (RdrName )
4343import SrcLoc (GenLocated (.. ), Located ,
4444 RealLocated )
@@ -312,9 +312,11 @@ putName decl@MkDataDecl{..} =
312312 putRdrName dataDeclName
313313 space
314314 forM_ secondTvar putOutputable
315+ maybePutKindSig
315316 else do
316317 putRdrName dataDeclName
317318 forM_ (hsq_explicit dataTypeVars) (\ t -> space >> putOutputable t)
319+ maybePutKindSig
318320
319321 where
320322 firstTvar :: Maybe (Located (HsTyVarBndr GhcPs ))
@@ -330,6 +332,12 @@ putName decl@MkDataDecl{..} =
330332 & drop 1
331333 & listToMaybe
332334
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+
333341putConstructor :: Config -> Int -> Located (ConDecl GhcPs ) -> P ()
334342putConstructor cfg consIndent (L _ cons) = case cons of
335343 ConDeclGADT {.. } -> do
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ tests = testGroup "Language.Haskell.Stylish.Step.Data.Tests"
7575 , testCase " case 60" case60
7676 , testCase " case 61 (issue 282)" case61
7777 , testCase " case 62 (issue 273)" case62
78+ , testCase " case 63 (issue 338)" case63
7879 ]
7980
8081case00 :: Assertion
@@ -1377,6 +1378,17 @@ case62 = expected @=? testStep (step sameIndentStyle) input
13771378 , " }"
13781379 ]
13791380
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+
13801392sameSameStyle :: Config
13811393sameSameStyle = Config SameLine SameLine 2 2 False True SameLine False True NoMaxColumns
13821394
You can’t perform that action at this time.
0 commit comments