我用Hakyll写了一个上下文定义:
import qualified Data.Map as M
....
mathCtx :: Context String
mathCtx = field "mathjax" $ \item -> do
metadata <- getMetadata $ itemIdentifier item
return $ if "mathjax" `M.member` (metadata)
then "<script type=\"text/javascr ... script>"
else ""
在我迁移到Debian 9
,Hakyll 4.9.2.0
和GHC 8.0.1
之前,它运作良好。现在,编译时出现此错误消息:
• 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.1:Data.Aeson.Types.Internal.Value’
with ‘M.Map [Char] a0’
Expected type: M.Map [Char] a0
Actual type: Metadata
• In the second argument of ‘M.member’, namely ‘(metadata)’
In the expression: "mathjax" `M.member` (metadata)
In the second argument of ‘($)’, namely
‘if "mathjax" `M.member` (metadata) then
"<script type=\"text/javascr ... script>"
else
""’
你知道我的功能现在出了什么问题以及如何解决这个问题吗?