@@ -1,5 +1,6 @@
1-- | A formatter for Haskell source code.
1-- | A formatter for Haskell source code.
3+{-# LANGUAGE BangPatterns #-}
3{-# LANGUAGE RecordWildCards #-}
4{-# LANGUAGE RecordWildCards #-}
5module Ormolu
6module Ormolu
@@ -55,7 +56,12 @@ ormolu cfg path str = do
55 traceM "warnings:\n"
56 traceM "warnings:\n"
56 traceM (concatMap showWarn ws)
57 traceM (concatMap showWarn ws)
57 traceM (prettyPrintParseResult result0)
58 traceM (prettyPrintParseResult result0)
59+ -- NOTE We're forcing 'txt' here because otherwise errors (such as
60+ -- messages about not-yet-supported functionality) will be thrown later
61+ -- when we try to parse the rendered code back, inside of GHC monad
62+ -- wrapper which will lead to error messages presenting the exceptions as
58− let txt = printModule (cfgDebug cfg) result0
64+ let !txt = printModule (cfgDebug cfg) result0
59 when (not (cfgUnsafe cfg) || cfgCheckIdempotency cfg) $ do
65 when (not (cfgUnsafe cfg) || cfgCheckIdempotency cfg) $ do
60 let pathRendered = path ++ "<rendered>"
66 let pathRendered = path ++ "<rendered>"
61 -- Parse the result of pretty-printing again and make sure that AST
67 -- Parse the result of pretty-printing again and make sure that AST