on ryan-jsstring-inline help sign in
text/scripts/ApiCompare.hs
28 lines 877 B history raw
1-- This script compares the strict and lazy Text APIs to ensure that
2-- they're reasonably in sync.
4{-# LANGUAGE OverloadedStrings #-}
6import qualified Data.Set as S
7import qualified Data.Text as T
8import System.Process
10main = 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