0
這是問題所在。它看起來很簡單但read :: Int未在Haskell中工作示例
main = do
s <- getContents
let list = map (read::Int) (words s)
print list
Couldn't match expected type `Int' with actual type `String -> a0'
Probable cause: `read' is applied to too few arguments
In the first argument of `map', namely `(read :: Int)'
In the expression: map (read :: Int) (words s)
問題是,我認爲::就像鑄造,我必須把返回類型。解決方案是添加完整的想要的功能簽名instread。