@@ -16,7 +16,6 @@ module Ormolu.Printer.Combinators
1616 , atom
1717 , newline
1818 , inci
19− , relaxComments
2019 , located
2120 , locatedVia
2221 , located'
@@ -30,6 +29,7 @@ module Ormolu.Printer.Combinators
3029 , spaceSep
3130 , newlineSep
3231 -- ** Wrapping
32+ , sitcc
3333 , line
3434 , backticks
3535 , braces
@@ -43,7 +43,6 @@ module Ormolu.Printer.Combinators
4343 )
4444where
4545
46−import Data.Bool (bool)
4746import Data.Data (Data)
4847import Data.List (intersperse)
4948import Data.Text (Text)
@@ -94,24 +93,22 @@ locatedVia
9493 -> (a -> R ()) -- ^ How to render inner value
9594 -> R ()
9695locatedVia ml loc f = do
97− relaxed <- relaxedComments
98− bool sitcc id relaxed $ do
99− let withRealLocated (L l a) g =
100− case l of
101− UnhelpfulSpan _ -> return ()
102− RealSrcSpan l' -> g (L l' a)
103− withRealLocated loc spitPrecedingComments
104− let setEnclosingSpan =
105− case getSpan loc of
106− UnhelpfulSpan _ -> id
107− RealSrcSpan orf ->
108− if isModule (unL loc)
109− then id
110− else withEnclosingSpan orf
111− setEnclosingSpan $ case ml of
112− Nothing -> f (unL loc)
113− Just l' -> switchLayout l' (f (unL loc))
114− withRealLocated loc spitFollowingComments
96+ let withRealLocated (L l a) g =
97+ case l of
98+ UnhelpfulSpan _ -> return ()
99+ RealSrcSpan l' -> g (L l' a)
100+ withRealLocated loc spitPrecedingComments
101+ let setEnclosingSpan =
102+ case getSpan loc of
103+ UnhelpfulSpan _ -> id
104+ RealSrcSpan orf ->
105+ if isModule (unL loc)
106+ then id
107+ else withEnclosingSpan orf
108+ setEnclosingSpan $ case ml of
109+ Nothing -> f (unL loc)
110+ Just l' -> switchLayout l' (f (unL loc))
111+ withRealLocated loc spitFollowingComments
115112
116113-- | A version of 'located' with arguments flipped.
117114