4
示例代码:Haskell的类型转换问题
fac :: Int → Int
fac 0 = 1
fac n = n * fac (n-1)
main = do
putStrLn show fac 10
错误:
Couldnt match expected type 'String'
against inferred type 'a -> String'
In the first argument of 'putStrLn', namely 'show'
In the expression: putStrLn show fac 10
+1' $'是你的朋友。 – 2009-12-25 07:43:17
($)和(。)是你爱的朋友<3 – codebliss 2009-12-25 16:42:47