on master help sign in
Remove space leaks in a more robust way (#578)

Follow up from #557. We definitely want the progress state to be fully evaluated, so demand that with evaluating functions like evaluate and $!, rather than relying on the compiler to get it right. My guess is the `$!` is unnecessary now we have `evaluate`, but it's also not harmful, so belt and braces approach.

commite16e841fa7e51b7950fd309196c1b16e51f95983 authorNeil Mitchell <ndmitchell@gmail.com> dateFri 22 May 2020, 15:11 (6 years ago) parent3ec5edf
1 file changed+1−1
src/Development/IDE/Core/Shake.hs+1−1
src/Development/IDE/Core/Shake.hs+1−1
@@ -541,7 +541,7 @@ withProgress var file = actionBracket (f succ) (const $ f pred) . const
541541 -- This functions are deliberately eta-expanded to avoid space leaks.
542542 -- Do not remove the eta-expansion without profiling a session with at
543543 -- least 1000 modifications.
544− where f shift = modifyVar_ var $ \x -> return (HMap.alter (\x -> Just (shift (fromMaybe 0 x))) file x)
544+ where f shift = modifyVar_ var $ \x -> evaluate $ HMap.alter (\x -> Just $! shift (fromMaybe 0 x)) file x
545545
546546
547547defineEarlyCutoff