-2
一個複雜的字符串我已經做了JSON哈斯克爾解析器這是工作完全正確的解析器解碼哈斯克爾
decodeToMaybeValue::BLC.ByteString->Maybe Value
decodeToMaybeValue = decode
main = do
interact (show . decodeToMaybeValue . BLC.pack)
該編譯器直接編譯時工作絕對正確的,但是當我嘗試存儲將字符串放入一個變量來解碼它會產生這個錯誤。我試圖
x =`"{\"apiVersion\": \"2.0\",\"data\": {\"updated\": \"2010-01-07T19:58:42.949Z\",\"totalItems\": 800,\"startIndex\": 1,\"itemsPerPage\": 1,\"items\": [{\"id\": \"hYB0mn5zh2c\",\"uploaded\":\"2007-06-05T22:07:03.000Z\",\"updated\": \"2010-01-07T13:26:50.000Z\",\"uploader\": \"GoogleDeveloperDay\",\"category\": \"News\",\"title\": \"Google Developers Day US - Maps API Introduction\",\"description\": \"Google Maps API Introduction ...\",\"tags\": [\"GDD07\",\"GDD07US\",\"Maps\"],\"duration\": 2840,\"aspectRatio\": \"widescreen\",\"rating\": 4.63,\"ratingCount\": 68,\"viewCount\": 220101,\"favoriteCount\":201,\"commentCount\": 22 }]}}"`
y = BLC.pack x
Invalid type signature: decode y :: Maybe Value
-- Should be of form <variable> :: <type>
有沒有人有想法呢?
是的,我完全想要這個 – 2014-11-03 21:27:00