一切是偉大的工作,直到大約一個月前...M.Map突然預計類型的錯誤
突然向我
berkson.github.io/source/blog.hs: 333, 42
• Couldn't match type ‘unordered-containers-0.2.7.1:Data.HashMap.Base.HashMap
text-1.2.2.1:Data.Text.Internal.Text
aeson-0.11.2.0:Data.Aeson.Types.Internal.Value’
with ‘M.Map [Char] [Char]’
Expected type: M.Map [Char] [Char]
Actual type: Metadata
• In the first argument of ‘(M.!)’, namely ‘md’
In the first argument of ‘(++)’, namely ‘(md M.! "author")’
In the second argument of ‘(++)’, namely ‘(md M.! "author") ++ "/"’
從代碼:
directorizeDateAndAuthor :: Routes
directorizeDateAndAuthor = metadataRoute $ \md ->
gsubRoute "/[0-9]{4}-[0-9]{2}-[0-9]{2}-" $ \s ->
replaceAll "-" (const "/") s ++ (md M.! "author") ++ "/"
我想知道你是否願意幫助我解釋它究竟告訴了我什麼?我知道在我的結尾有一些類型的語法錯誤,但我不明白是什麼改變了,爲什麼它不像以前那樣編譯?
價:https://github.com/berkson/berkson.github.io/blob/source/source/blog.hs#L330
我的猜測是你升級了定義'Metadata'的包,並且該包從定義爲'Map'變爲'HashMap'。您需要更新此類用途才能使用'HashMap。!'而不是'M.!'。或者你可以改變你的cabal文件以依賴於舊版本的軟件包。 – luqui
在hakyll 4.8'元數據'類型從'Map'改爲'Aeson.Object'(參見[發佈公告](https://groups.google.com/forum/#!topic/hakyll/M3SNUkH2zsQ)) –
@JanTojnar GAH!謝謝你告訴我,但現在我更加迷失了!我認爲這只是一個替代本身的下降,而不是我得到之前的錯誤: '無法與實際類型'值'匹配預期類型'[Char]' 取而代之的是! > _
Berkson