0

I wrote a context definition with Hakyll like this :

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 ""

It worked well until I migrated to Debian 9, Hakyll 4.9.2.0 and GHC 8.0.1. Now, I have this error message when compiling :

• 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
         ""’

Do you know what is going wrong now with my function and how to correct this ?

JeanJouX
  • 2,555
  • 1
  • 25
  • 37
  • 1
    Hackage doesn't know of a Hakyll 0.9.2.0, and it would be really old if it did exist. Did you mean 4.9.2.0? Furthermore, do you know what you upgraded from? – icktoofay Jul 04 '17 at 22:09
  • 1
    have you tried adding `{-# LANGUAGE OverloadedStrings -#}` Metadata is a type alias for `HashMap Text Value` and the compiler complains about the "mathjax" being a `String` – epsilonhalbe Jul 04 '17 at 22:12
  • Migrated from what to your current choice? – Bergi Jul 04 '17 at 22:15

0 Answers0