我有一个问题:如何抛出异常并退出程序?我写了一个简单的例子:
-- main.hs
import Test
main = do
Test.foo ""
putStrLn "make some other things"
这是模块:
moldule Test where
foo :: String -> IO ()
foo x = do
if null x
then THROW EXCEPTION AND EXIT MAIN else putStrLn "okay"
我想启动它并抛出异常并退出程序,但是如何?