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

main = do
  let m1 = Map.fromList [(x,show x) | x <- ['a'..chr 10000]]
      m2 = Map.fromList [(x,y) | x <- ['a'..chr 10000],
                                 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