sdiehl / write-you-a-haskell

Building a modern functional compiler from first principles. (http://dev.stephendiehl.com/fun/)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to compile with current toolchain

mouse07410 opened this issue · comments

commented

MacOS Catalina 10.15.5, GHC-8.8.3, Stack-2.3.1, current LaTeX (MacTeX-2020):

$ stack exec make
pandoc -c css/style.css --filter includes.hs --template template.html -s -f markdown -t html --standalone --toc --toc-depth=2 --mathjax="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --highlight-style pygments -o 000_introduction.html 000_introduction.md

includes.hs:6:1: error:
    Could not find module ‘Text.Pandoc’
    Perhaps you meant Text.Parsec (from parsec-3.1.14.0)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
6 | import Text.Pandoc
  | ^^^^^^^^^^^^^^^^^^

includes.hs:10:1: error:
    Could not find module ‘Text.Pandoc.JSON’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
10 | import Text.Pandoc.JSON
   | ^^^^^^^^^^^^^^^^^^^^^^^

includes.hs:11:1: error:
    Could not find module ‘Text.Pandoc.Walk’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
11 | import Text.Pandoc.Walk
   | ^^^^^^^^^^^^^^^^^^^^^^^
Error running filter includes.hs:
Filter returned error status 1
make: *** [000_introduction.html] Error 83

$ stack --version
Version 2.3.1, Git revision de2a7b694f07de7e6cf17f8c92338c16286b2878 (8103 commits) x86_64 hpack-0.33.0
$ pandoc --version
pandoc 2.9.2.1
Compiled with pandoc-types 1.20, texmath 0.12.0.2, skylighting 0.8.4
Default user data directory: /Users/ur20980/.local/share/pandoc or /Users/ur20980/.pandoc
Copyright (C) 2006-2020 John MacFarlane
Web:  https://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.3

It would be great if you could help getting this book compiled/built. Thanks!

commented

After installing Pandoc via Stack (there was Cabal-built executable on the PATH before that), the errors changed, but still no success:

$ stack exec make
pandoc -c css/style.css --filter includes.hs --template template.html -s -f markdown -t html --standalone --toc --toc-depth=2 --mathjax="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --highlight-style pygments -o 000_introduction.html 000_introduction.md

includes.hs:19:28: error:
    • Couldn't match type ‘Data.Text.Internal.Text’ with ‘[Char]’
      Expected type: Maybe String
        Actual type: Maybe Data.Text.Internal.Text
    • In the second argument of ‘(=<<)’, namely
        ‘lookup "upper" namevals’
      In a stmt of a 'do' block:
        upper <- readMaybe =<< lookup "upper" namevals
      In the second argument of ‘($)’, namely
        ‘do upper <- readMaybe =<< lookup "upper" namevals
            lower <- readMaybe =<< lookup "lower" namevals
            file <- lookup "slice" namevals
            return (upper, lower, file)’
   |
19 |     upper <- readMaybe =<< lookup "upper" namevals
   |                            ^^^^^^^^^^^^^^^^^^^^^^^

includes.hs:20:28: error:
    • Couldn't match type ‘Data.Text.Internal.Text’ with ‘[Char]’
      Expected type: Maybe String
        Actual type: Maybe Data.Text.Internal.Text
    • In the second argument of ‘(=<<)’, namely
        ‘lookup "lower" namevals’
      In a stmt of a 'do' block:
        lower <- readMaybe =<< lookup "lower" namevals
      In the second argument of ‘($)’, namely
        ‘do upper <- readMaybe =<< lookup "upper" namevals
            lower <- readMaybe =<< lookup "lower" namevals
            file <- lookup "slice" namevals
            return (upper, lower, file)’
   |
20 |     lower <- readMaybe =<< lookup "lower" namevals
   |                            ^^^^^^^^^^^^^^^^^^^^^^^

includes.hs:27:28: error:
    • Couldn't match type ‘Data.Text.Internal.Text’ with ‘[Char]’
      Expected type: FilePath
        Actual type: Data.Text.Internal.Text
    • In the first argument of ‘readFile’, namely ‘f’
      In a stmt of a 'do' block: contents <- readFile f
      In the expression:
        do contents <- readFile f
           let lns = unlines $ slice lower upper (lines contents)
           return (CodeBlock (id, classes, namevals) lns)
   |
27 |       contents <- readFile f
   |                            ^

includes.hs:29:49: error:
    • Couldn't match type ‘[Char]’ with ‘Data.Text.Internal.Text’
      Expected type: Data.Text.Internal.Text
        Actual type: String
    • In the second argument of ‘CodeBlock’, namely ‘lns’
      In the first argument of ‘return’, namely
        ‘(CodeBlock (id, classes, namevals) lns)’
      In a stmt of a 'do' block:
        return (CodeBlock (id, classes, namevals) lns)
   |
29 |       return (CodeBlock (id, classes, namevals) lns)
   |                                                 ^^^

includes.hs:35:71: error:
    • Couldn't match type ‘[Char]’ with ‘Data.Text.Internal.Text’
      Expected type: IO Data.Text.Internal.Text
        Actual type: IO String
    • In the second argument of ‘(=<<)’, namely ‘readFile f’
      In the expression:
        return . (CodeBlock (id, classes, namevals)) =<< readFile f
      In a case alternative:
          Just f
            -> return . (CodeBlock (id, classes, namevals)) =<< readFile f
   |
35 |        Just f     -> return . (CodeBlock (id, classes, namevals)) =<< readFile f
   |                                                                       ^^^^^^^^^^

includes.hs:35:80: error:
    • Couldn't match type ‘Data.Text.Internal.Text’ with ‘[Char]’
      Expected type: FilePath
        Actual type: Data.Text.Internal.Text
    • In the first argument of ‘readFile’, namely ‘f’
      In the second argument of ‘(=<<)’, namely ‘readFile f’
      In the expression:
        return . (CodeBlock (id, classes, namevals)) =<< readFile f
   |
35 |        Just f     -> return . (CodeBlock (id, classes, namevals)) =<< readFile f
   |                                                                                ^

includes.hs:42:53: error:
    • Couldn't match type ‘[Char]’ with ‘Data.Text.Internal.Text’
      Expected type: IO Data.Text.Internal.Text
        Actual type: IO String
    • In the second argument of ‘(=<<)’, namely ‘readFile f’
      In the expression: return . (RawBlock "html") =<< readFile f
      In a case alternative:
          Just f -> return . (RawBlock "html") =<< readFile f
   |
42 |        Just f     -> return . (RawBlock "html") =<< readFile f
   |                                                     ^^^^^^^^^^

includes.hs:42:62: error:
    • Couldn't match type ‘Data.Text.Internal.Text’ with ‘[Char]’
      Expected type: FilePath
        Actual type: Data.Text.Internal.Text
    • In the first argument of ‘readFile’, namely ‘f’
      In the second argument of ‘(=<<)’, namely ‘readFile f’
      In the expression: return . (RawBlock "html") =<< readFile f
   |
42 |        Just f     -> return . (RawBlock "html") =<< readFile f
   |                                                              ^

includes.hs:53:51: error:
    • Couldn't match type ‘[Char]’ with ‘Data.Text.Internal.Text’
      Expected type: Data.Text.Internal.Text
        Actual type: String
    • In the second argument of ‘($)’, namely ‘macros’
      In the expression:
        Div ("", [], [("style", "display:none")])
          . (: []) . Para . (: []) . Math DisplayMath
          $ macros
      In a case alternative:
          Format "html"
            -> Div ("", [], [("style", "display:none")])
                 . (: []) . Para . (: []) . Math DisplayMath
                 $ macros
   |
53 |               . Para . (:[]) . Math DisplayMath $ macros
   |                                                   ^^^^^^

includes.hs:54:46: error:
    • Couldn't match type ‘[Char]’ with ‘Data.Text.Internal.Text’
      Expected type: Data.Text.Internal.Text
        Actual type: String
    • In the second argument of ‘RawBlock’, namely ‘macros’
      In the expression: RawBlock "latex" macros
      In a case alternative: Format "latex" -> RawBlock "latex" macros
   |
54 |           Format "latex" -> RawBlock "latex" macros
   |                                              ^^^^^^

includes.hs:55:45: error:
    • Couldn't match type ‘[Char]’ with ‘Data.Text.Internal.Text’
      Expected type: Data.Text.Internal.Text
        Actual type: String
    • In the second argument of ‘RawBlock’, namely ‘macros’
      In the expression: RawBlock "latex" macros
      In a case alternative: Format "epub" -> RawBlock "latex" macros
   |
55 |           Format "epub" -> RawBlock "latex" macros
   |                                             ^^^^^^
Error running filter includes.hs:
Filter returned error status 1
make: *** [000_introduction.html] Error 83

Also, EPUB versions of this ebook, and or "What I Wish I Knew..." fail to properly display on MacOS and iOS - all the command examples and such are displayed as empty gray boxes. It would be great if you could re-generate EPUB versions. Pre-built PDF files appear OK.