我無法完全弄清楚do
塊中case
表達式的語法問題。Haskell句法表達式在do塊中
什麼是正確的語法?
如果你能糾正我的例子,並解釋它會是最好的。
module Main where
main = do
putStrLn "This is a test"
s <- foo
putStrLn s
foo = do
args <- getArgs
return case args of
[] -> "No Args"
[s]-> "Some Args"
稍微更新一下。我的源文件是空格和製表符的混合,導致各種問題。 對於Haskell中的其他人來說,這只是一個提示。如果您遇到問題,請檢查源代碼中的製表符和空格。
我以爲嘗試了這兩種選擇。在發送問題之前。 傻我。 謝謝 – Ted 2008-10-01 17:02:07