summaryrefslogtreecommitdiff
path: root/libraries/ghc-compact/tests/compact_gc.hs
blob: 2e13bafdbe6acf75c204444bdc260f9f7923b56e (plain)
1
2
3
4
5
6
7
8
9
10
11
import Control.Monad
import GHC.Compact
import qualified Data.Map as Map

main = do
  let m = Map.fromList [(x,show x) | x <- [1..(10000::Int)]]
  c <- compactWithSharing m
  print =<< compactSize c
  c <- foldM (\c _ -> do c <- compactWithSharing (getCompact c); print =<< compactSize c; return c) c [1..10]
  print (length (show (getCompact c)))
  print =<< compactSize c