
Viktor Dukhovni wrote:
I am seeing surprising results from 'inCompact' after 'compact'. It seems there are additional limitations on what can be compacted, with 'compact' not throwing a 'CompactionFailed' exception in some cases, and yet not compacting the value. Is this expected?
This seems to be a documentation problem. `compact` forces and copies /most/ of the data, but there are some exceptions: - data that is already compacted is not copied (this does not happen in your example, I think) - statically allocated data is not copied either. This includes nullary constructors like (), [], or Data.Map.Internal.Tip (the empty map) as well as many statically known values like 42 :: Int See also shouldCompact(), https://github.com/ghc/ghc/blob/master/rts/sm/CNF.c#L615 which is called several times in stg_compactAddWorkerzh, https://github.com/ghc/ghc/blob/master/rts/Compact.cmm#L50 Cheers, Bertram