Minor cleanup / performance improvement
parent
867016c198
commit
d1606932f8
|
@ -111,11 +111,9 @@ commentAnnFixTransformGlob :: SYB.Data ast => ast -> ExactPrint.Transform ()
|
||||||
commentAnnFixTransformGlob ast = do
|
commentAnnFixTransformGlob ast = do
|
||||||
let extract :: forall a . SYB.Data a => a -> Seq (SrcSpan, ExactPrint.AnnKey)
|
let extract :: forall a . SYB.Data a => a -> Seq (SrcSpan, ExactPrint.AnnKey)
|
||||||
extract = -- traceFunctionWith "extract" (show . SYB.typeOf) show $
|
extract = -- traceFunctionWith "extract" (show . SYB.typeOf) show $
|
||||||
const Seq.empty `SYB.ext2Q` (\(L a b) -> f1 a b)
|
const Seq.empty
|
||||||
where
|
`SYB.ext1Q`
|
||||||
f1 b c = (const Seq.empty `SYB.extQ` f2 c) b
|
(\l@(L span _) -> Seq.singleton (span, ExactPrint.mkAnnKey l))
|
||||||
f2 c l = Seq.singleton (l, ExactPrint.mkAnnKey (L l c))
|
|
||||||
-- i wonder if there is a way to avoid re-constructing the L above..
|
|
||||||
let nodes = SYB.everything (<>) extract ast
|
let nodes = SYB.everything (<>) extract ast
|
||||||
let annsMap :: Map GHC.RealSrcLoc ExactPrint.AnnKey
|
let annsMap :: Map GHC.RealSrcLoc ExactPrint.AnnKey
|
||||||
annsMap = Map.fromListWith
|
annsMap = Map.fromListWith
|
||||||
|
|
Loading…
Reference in New Issue