traceTc is inefficient
The current definition of traceTc
:
traceTc :: forall a. String -> Doc a -> Tc ()
traceTc fname message = do
path <- getTraceOutputPath
case path of
Nothing -> pure ()
Just x -> liftIO $
do actPath <- makeAbsolute x
exists <- doesPathExist actPath
let prettyMessage
= renderStrict
. layoutPretty defaultLayoutOptions
. (<+> line)
$ vcat [pretty fname <+> lbrace
,indent 1 message
,rbrace]
if exists
then T.appendFile actPath prettyMessage
else T.writeFile actPath prettyMessage
Use a proper logging mechanism instead.