Stabilise benchmarks wrt. GC
[nofib.git] / real / infer / Main.hs
1 module Main where
2
3 import Parse
4 import Shows
5 import Term
6 import Type
7 import Environment
8 import InferMonad
9 import Substitution ( Sub )
10 import MaybeM ( Maybe )
11 import Infer
12
13 import Control.Monad
14 import System.Environment
15 import NofibUtils
16
17 main = do
18 input <- getContents
19 replicateM_ 200 $ do
20 input' <- salt input
21 let inferred = concat (map readInferShow (lines input'))
22 print (hash (showsString (show testEnv ++ prompt) inferred))
23
24 readInferShow :: String -> String
25 readInferShow = useP ("Failed to parse" ++ prompt) (
26 lexactlyP reads `eachP` (\t ->
27 useI ("Failed to type" ++ prompt) (
28 inferTerm testEnv t `eachI` (\tt ->
29 show t ++ " : " ++ show tt ++ prompt))))
30 testEnv :: Env
31 testEnv = read
32 ( "[ unit : x -> List x,"
33 ++ " append : List x -> List x -> List x,"
34 ++ " fix : (x -> x) -> x ]"
35 )
36 prompt :: String
37 prompt = "\n? "