From 317a0fca103382829105376ff7ef72b238bd6931 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Tue, 1 Nov 2022 19:49:27 -0700 Subject: [PATCH] Move LocatedL into p_hsmodExports --- src/Ormolu/Printer/Meat/ImportExport.hs | 17 +++++++++-------- src/Ormolu/Printer/Meat/Module.hs | 5 +---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Ormolu/Printer/Meat/ImportExport.hs b/src/Ormolu/Printer/Meat/ImportExport.hs index 38b31788..26fedc86 100644 --- a/src/Ormolu/Printer/Meat/ImportExport.hs +++ b/src/Ormolu/Printer/Meat/ImportExport.hs @@ -19,14 +19,15 @@ import Ormolu.Printer.Combinators import Ormolu.Printer.Meat.Common import Ormolu.Utils (RelativePos (..), attachRelativePos) -p_hsmodExports :: [LIE GhcPs] -> R () -p_hsmodExports xs = - parens N $ do - layout <- getLayout - sep - breakpoint - (\(p, l) -> sitcc (located l (p_lie layout p))) - (attachRelativePos xs) +p_hsmodExports :: LocatedL [LIE GhcPs] -> R () +p_hsmodExports lexports = + located lexports $ \exports -> + inci . parens N $ do + layout <- getLayout + sep + breakpoint + (\(p, l) -> sitcc (located l (p_lie layout p))) + (attachRelativePos exports) p_hsmodImport :: ImportDecl GhcPs -> R () p_hsmodImport ImportDecl {..} = do diff --git a/src/Ormolu/Printer/Meat/Module.hs b/src/Ormolu/Printer/Meat/Module.hs index 5eebe10a..1137d74d 100644 --- a/src/Ormolu/Printer/Meat/Module.hs +++ b/src/Ormolu/Printer/Meat/Module.hs @@ -53,10 +53,7 @@ p_hsModule mstackHeader pragmas HsModule {..} = do breakpoint case hsmodExports of Nothing -> return () - Just l -> do - located l $ \exports -> do - inci (p_hsmodExports exports) - breakpoint + Just exports -> p_hsmodExports exports >> breakpoint txt "where" newline newline