1
Possible Duplicate:
Incomplete type signature部分類型簽名
考慮以下幾點:
import Network.HTTP.Conduit
(parseUrl "http://stackoverflow.com") :: Maybe a
parseUrl
回報Failure HttpException m => m (Request m')
它的文件說:
Since this function uses
Failure
, the return monad can be anything that is an instance ofFailure
, such asIO
orMaybe
.
然而,當我試圖迫使parseUrl
使用Maybe
,我得到以下錯誤:
main.hs:9:11:
Couldn't match type `a' with `Request m'0'
`a' is a rigid type variable bound by
an expression type signature: Maybe a at main.hs:9:10
Expected type: Maybe a
Actual type: Maybe (Request m'0)
反正是有強制類型Maybe
沒有指定完整確切類型?包括GHC擴展在內的答案很好。
需要注意的是這個工程:
f :: Maybe a -> Maybe a
f x = x
f (parseUrl "http://stackoverflow.com")
但似乎醜陋的我。
我已經問過關於這個更好的問題http://stackoverflow.com/questions/11751318/incomplete-type-signature – Clinton 2012-08-01 01:23:28