Bump version to 1.2.0.2
[packages/text.git] / scripts / ApiCompare.hs
1 -- This script compares the strict and lazy Text APIs to ensure that
2 -- they're reasonably in sync.
3
4 {-# LANGUAGE OverloadedStrings #-}
5
6 import qualified Data.Set as S
7 import qualified Data.Text as T
8 import System.Process
9
10 main = do
11 let tidy pkg = (S.fromList . filter (T.isInfixOf "::") . T.lines .
12 T.replace "GHC.Int.Int64" "Int" .
13 T.replace "\n " "" .
14 T.replace (T.append (T.pack pkg) ".") "" . T.pack) `fmap`
15 readProcess "ghci" [] (":browse " ++ pkg)
16 let diff a b = mapM_ (putStrLn . (" "++) . T.unpack) . S.toList $
17 S.difference a b
18 text <- tidy "Data.Text"
19 lazy <- tidy "Data.Text.Lazy"
20 list <- tidy "Data.List"
21 putStrLn "Text \\ List:"
22 diff text list
23 putStrLn ""
24 putStrLn "Text \\ Lazy:"
25 diff text lazy
26 putStrLn ""
27 putStrLn "Lazy \\ Text:"
28 diff lazy text