case pModule ts of
Bad s -> error ("Parse failed in " ++ show f ++ "\n" ++ show s)
Ok mod@(Module (AIdent (_,name)) imp decls) -> do
let imp_ctt = [prefix ++ i ++ ".ctt" | Import (AIdent (_,i)) <- imp]
when (name /= dropExtension (takeFileName f)) $
error ("Module name mismatch in " ++ show f ++ " with wrong name " ++ "\"" ++ name ++ "\"")
(notok1,loaded1,mods1) <-
foldM (imports v) (f:notok,loaded,mods) imp_ctt
when v $ putStrLn $ "Parsed " ++ show f ++ " successfully!"
return (notok,f:loaded1,mods1 ++ [mod])
help :: String
help = "\nAvailable commands:\n" ++
" <statement> infer type and evaluate statement\n" ++
" :n <statement> normalize statement\n" ++
" :q quit\n" ++
" :l <filename> loads filename (and resets environment before)\n" ++
" :cd <path> change directory to path\n" ++
" :r reload\n" ++
" :h display this message\n"