summaryrefslogtreecommitdiff
path: root/libraries/ghc-compact/tests/compact_share.hs
blob: 323c179cca005ebe0973db0896d0a05c1951bb28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import GHC.Compact
import qualified Data.Map as Map

main = do
  let m1 = Map.fromList [(x,show x) | x <- [1..(10000::Integer)]]
      m2 = Map.fromList [(x,y) | x <- [1..(10000::Integer)],
                                 Just y <- [Map.lookup x m1]]
  c <- compact (m1,m2)
  print (length (show (getCompact c)))
  print =<< compactSize c
  c <- compactWithSharing (m1,m2)
  print (length (show (getCompact c)))
  print =<< compactSize c