@@ -16,7 +16,6 @@ module Ormolu.Printer.Combinators
21 , locatedVia
20 , locatedVia
22 , located'
21 , located'
@@ -30,6 +29,7 @@ module Ormolu.Printer.Combinators
30 , spaceSep
29 , spaceSep
31 , newlineSep
30 , newlineSep
32 -- ** Wrapping
31 -- ** Wrapping
34 , backticks
34 , backticks
@@ -43,7 +43,6 @@ module Ormolu.Printer.Combinators
46−import Data.Bool (bool)
47import Data.Data (Data)
46import Data.Data (Data)
48import Data.List (intersperse)
47import Data.List (intersperse)
49import Data.Text (Text)
48import Data.Text (Text)
@@ -94,24 +93,22 @@ locatedVia
94 -> (a -> R ()) -- ^ How to render inner value
93 -> (a -> R ()) -- ^ How to render inner value
96locatedVia ml loc f = do
95locatedVia ml loc f = do
97− relaxed <- relaxedComments
98− bool sitcc id relaxed $ do
99− let withRealLocated (L l a) g =
96+ let withRealLocated (L l a) g =
100− case l of
97+ case l of
101− UnhelpfulSpan _ -> return ()
98+ UnhelpfulSpan _ -> return ()
102− RealSrcSpan l' -> g (L l' a)
99+ RealSrcSpan l' -> g (L l' a)
103− withRealLocated loc spitPrecedingComments
100+ withRealLocated loc spitPrecedingComments
104− let setEnclosingSpan =
101+ let setEnclosingSpan =
105− case getSpan loc of
102+ case getSpan loc of
106− UnhelpfulSpan _ -> id
103+ UnhelpfulSpan _ -> id
107− RealSrcSpan orf ->
104+ RealSrcSpan orf ->
108− if isModule (unL loc)
105+ if isModule (unL loc)
110− else withEnclosingSpan orf
107+ else withEnclosingSpan orf
111− setEnclosingSpan $ case ml of
108+ setEnclosingSpan $ case ml of
112− Nothing -> f (unL loc)
109+ Nothing -> f (unL loc)
113− Just l' -> switchLayout l' (f (unL loc))
110+ Just l' -> switchLayout l' (f (unL loc))
114− withRealLocated loc spitFollowingComments
111+ withRealLocated loc spitFollowingComments
116-- | A version of 'located' with arguments flipped.
113-- | A version of 'located' with arguments flipped.