4
下無法編譯:爲什麼在GHC中沒有導入列表?
module Main where
import Text.JSON (JSObject, JSValue)
main = print "hello world"
getObject :: JSValue -> JSObject JSValue
getObject (JSObject x) = x
給錯誤:
Not in scope: data constructor `JSObject'
但是,消除導入列表允許它編譯成功成功(儘管JSObject
上面進口)
module Main where
import Text.JSON
main = print "hello world"
getObject :: JSValue -> JSObject JSValue
getObject (JSObject x) = x
爲什麼GHC(7.4.2)忽略我的進口JSObject
?
模塊聲明後縮進不是慣用的,所以如果你沒有特別附加,我會建議避免它。 – Davorak 2013-04-09 19:41:51