为什么不能在 Hint (Language.Haskell.Interpreter) 中将顶级模块设置为“Main”?
请允许我演示一下:
module Main where
import Language.Haskell.Interpreter
import Control.Monad
main = do
res <- runInterpreter (test "test")
case res of
Left e -> putStrLn (show e)
Right t -> putStrLn (show t)
return ()
test :: String -> Interpreter ()
test mname =
do
loadModules [mname ++ ".hs"]
setTopLevelModules ["Main"]
将导致:
NotAllowed "These modules are not interpreted:\nMain\n"