@@ -27,9 +27,9 @@ p_hsModule exts (L moduleSpan HsModule {..}) = do
27 -- NOTE If span of exports in multiline, the whole thing is multiline.
27 -- NOTE If span of exports in multiline, the whole thing is multiline.
28 -- This is especially important because span of module itself always seems
28 -- This is especially important because span of module itself always seems
29 -- to have length zero, so it's not reliable for layout selection.
29 -- to have length zero, so it's not reliable for layout selection.
30− let spans' = case hsmodExports of
30+ let exportSpans = maybe [] (\(L s _) -> [s]) hsmodExports
31− Nothing -> [moduleSpan]
31+ deprecSpan = maybe [] (\(L s _) -> [s]) hsmodDeprecMessage
32− Just (L exportsSpan _) -> moduleSpan : [exportsSpan]
32+ spans' = exportSpans ++ deprecSpan ++ [moduleSpan]
33 switchLayout spans' $ do
33 switchLayout spans' $ do
34 let hasLangPragmas = not (null exts)
34 let hasLangPragmas = not (null exts)
35 hasModuleHeader = isJust hsmodName
35 hasModuleHeader = isJust hsmodName
@@ -43,7 +43,9 @@ p_hsModule exts (L moduleSpan HsModule {..}) = do
43 Nothing -> pure ()
43 Nothing -> pure ()
44 Just hsmodName' -> line $ do
44 Just hsmodName' -> line $ do
45 located hsmodName' p_hsmodName
45 located hsmodName' p_hsmodName
46− forM_ hsmodDeprecMessage (located' p_moduleWarning)
46+ forM_ hsmodDeprecMessage $ \w -> do
48+ located' p_moduleWarning w
47 case hsmodExports of
49 case hsmodExports of
48 Nothing -> return ()
50 Nothing -> return ()
49 Just hsmodExports' -> do
51 Just hsmodExports' -> do