owickstrom / pandoc-include-code

A Pandoc filter for including code from source files
Mozilla Public License 2.0
139 stars 18 forks source link

Compilation fails with pandoc-types-1.20 #29

Closed abhin4v closed 4 years ago

abhin4v commented 4 years ago

Compilation fails with the following error:

[2 of 2] Compiling Text.Pandoc.Filter.IncludeCode
/private/var/folders/3b/9plp3gb959gcv_nyqg9j_k740000gn/T/stack70671/pandoc-include-code-1.4.0.0/src/Text/Pandoc/Filter/IncludeCode.hs:197:24: error:
    • Couldn't match type ‘Text’ with ‘[Char]’
      Expected type: HashMap String String
        Actual type: HashMap Text Text
    • In the first argument of ‘parseInclusion’, namely
        ‘(HM.fromList attrs)’
      In the expression: parseInclusion (HM.fromList attrs)
      In the expression:
        case parseInclusion (HM.fromList attrs) of
          Right (Just spec)
            -> runInclusion' spec allSteps
                 >>=
                   \case
                     Left err -> return (Left err)
                     Right (contents, state)
                       -> return
                            (Right
                               (CodeBlock
                                  (id', classes, modifyAttributes state classes attrs)
                                  (Text.unpack contents)))
          Right Nothing -> return (Right cb)
          Left err -> return (Left err)
    |
197 |   case parseInclusion (HM.fromList attrs) of
    |                        ^^^^^^^^^^^^^^^^^
/private/var/folders/3b/9plp3gb959gcv_nyqg9j_k740000gn/T/stack70671/pandoc-include-code-1.4.0.0/src/Text/Pandoc/Filter/IncludeCode.hs:205:34: error:
    • Couldn't match type ‘[Char]’ with ‘Text’
      Expected type: [(Text, Text)]
        Actual type: [(String, String)]
    • In the expression: modifyAttributes state classes attrs
      In the first argument of ‘CodeBlock’, namely
        ‘(id', classes, modifyAttributes state classes attrs)’
      In the first argument of ‘Right’, namely
        ‘(CodeBlock
            (id', classes, modifyAttributes state classes attrs)
            (Text.unpack contents))’
    |
205 |                   (id', classes, modifyAttributes state classes attrs)
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/private/var/folders/3b/9plp3gb959gcv_nyqg9j_k740000gn/T/stack70671/pandoc-include-code-1.4.0.0/src/Text/Pandoc/Filter/IncludeCode.hs:205:57: error:
    • Couldn't match type ‘Text’ with ‘[Char]’
      Expected type: [String]
        Actual type: [Text]
    • In the second argument of ‘modifyAttributes’, namely ‘classes’
      In the expression: modifyAttributes state classes attrs
      In the first argument of ‘CodeBlock’, namely
        ‘(id', classes, modifyAttributes state classes attrs)’
    |
205 |                   (id', classes, modifyAttributes state classes attrs)
    |                                                         ^^^^^^^
/private/var/folders/3b/9plp3gb959gcv_nyqg9j_k740000gn/T/stack70671/pandoc-include-code-1.4.0.0/src/Text/Pandoc/Filter/IncludeCode.hs:205:65: error:
    • Couldn't match type ‘Text’ with ‘[Char]’
      Expected type: [(String, String)]
        Actual type: [(Text, Text)]
    • In the third argument of ‘modifyAttributes’, namely ‘attrs’
      In the expression: modifyAttributes state classes attrs
      In the first argument of ‘CodeBlock’, namely
        ‘(id', classes, modifyAttributes state classes attrs)’
    |
205 |                   (id', classes, modifyAttributes state classes attrs)
    |                                                                 ^^^^^
/private/var/folders/3b/9plp3gb959gcv_nyqg9j_k740000gn/T/stack70671/pandoc-include-code-1.4.0.0/src/Text/Pandoc/Filter/IncludeCode.hs:206:20: error:
    • Couldn't match type ‘[Char]’ with ‘Text’
      Expected type: Text
        Actual type: String
    • In the second argument of ‘CodeBlock’, namely
        ‘(Text.unpack contents)’
      In the first argument of ‘Right’, namely
        ‘(CodeBlock
            (id', classes, modifyAttributes state classes attrs)
            (Text.unpack contents))’
      In the first argument of ‘return’, namely
        ‘(Right
            (CodeBlock
               (id', classes, modifyAttributes state classes attrs)
               (Text.unpack contents)))’
    |
206 |                   (Text.unpack contents)))
    |                    ^^^^^^^^^^^^^^^^^^^^
aubertc commented 4 years ago

Hi,

This is the same error message as here, as it seems:

https://github.com/jgm/pandoc/issues/5943

Normally, since this commit, it should compile just fine with pandoc-types 1.2.0.

Are you sure you are compiling the latest version?

It seems that you are compiling v. 1.4.0.0, but you need at least v. 1.5.0.0 according to the changelog to compile with Pandoc 2.8 / pandoc-types 1.20.

This bug could be related as well: how are you getting the source code?

abhin4v commented 4 years ago

v 1.5.0.0 worked. Thanks @aubertc. I'm closing this issue.