1 {- A simple driver that loads, typechecks, prepares, re-typechecks, and interprets the
2 GHC standard Prelude modules and an application module called Main.
4 Note that, if compiled under GHC, this requires a very large heap to run!
19 process (senv,modules) f =
20 do putStrLn ("Processing " ++ f)
23 OkP m -> do putStrLn "Parse succeeded"
24 {- writeFile (f ++ ".parsed") (show m) -}
25 case checkModule senv m of
27 do putStrLn "Check succeeded"
28 let m' = prepModule senv' m
29 {- writeFile (f ++ ".prepped") (show m') -}
30 case checkModule senv m' of
32 do putStrLn "Recheck succeeded"
33 return (senv'',modules ++ [m'])
35 do putStrLn ("Recheck failed: " ++ s)
38 do putStrLn ("Check failed: " ++ s)
40 FailP s -> do putStrLn ("Parse failed: " ++ s)
43 main = do (_,modules) <- foldM process (initialEnv,[]) flist
44 let result = evalProgram modules
45 putStrLn ("Result = " ++ show result)
47 where flist = ["PrelBase.hcr",
75 "PrelMarshalAlloc.hcr",
76 "PrelMarshalUtils.hcr",
77 "PrelMarshalArray.hcr",
79 "PrelMarshalError.hcr",