If I use GHC 9.4.7 instead (lts-21.21
- which specifies the same version of pandoc
), I can’t reproduce the problem on Ubuntu (via WSL2):
{- stack --verbose script --resolver lts-21.21 --package pandoc -}
import Prelude
import Text.Pandoc
main :: IO ()
main = putStrLn "Pandoc detected"
EDT: lts-21.25
has (extract):
- hackage: pandoc-3.0.1@sha256:b86cff1afae695247ee180ac66769881a4900ea4643c87820a9f653dd06d4cf2,37767
pantry-tree:
sha256: 4ceae05f232ec6e0a062b36d89da99ad071ef8f498b141ac748c219136b789d3
size: 141318
lts-21.21
has (extract), which is identical:
- hackage: pandoc-3.0.1@sha256:b86cff1afae695247ee180ac66769881a4900ea4643c87820a9f653dd06d4cf2,37767
pantry-tree:
sha256: 4ceae05f232ec6e0a062b36d89da99ad071ef8f498b141ac748c219136b789d3
size: 141318
EDIT: If I explore with --ghc-options -v
, the one that works has:
Loading unit pandoc-3.0.1 ... linking ... done.
and the one that does not work does not. (The one that works also loads lots of other units that the one that does not work does not.)
Both start with (where x
is the GHC minor version):
*** initializing unit database:
package flags [-package base{package base True ([])},
-package pandoc{package pandoc True ([])}]
loading package database /home/mpilgrem/.stack/programs/x86_64-linux/ghc-tinfo6-9.4.x/lib/ghc-9.4.x/lib/package.conf.d
loading package database /home/mpilgrem/.stack/snapshots/x86_64-linux-tinfo6/<hash>/9.4.x/pkgdb
loading package database /home/mpilgrem/.stack/.stack-work/install/x86_64-linux-tinfo6/<hash>/9.4.x/pkgdb
and stack --resolver lts-21.nn exec -- ghc-pkg list pandoc
(where nn
is the relevant index) shows that that package database does expose pandoc-3.0.1
.
EDIT2: It is something about the Linux/GHC 9.4.8/pandoc
combination. If I pick, say, ansi-terminal
, there is no problem with Linux/GHC 9.4.8. So, this fails on Linux:
{- stack script
--verbose
--snapshot lts-21.25
-}
import Text.Pandoc
main :: IO ()
main = putStrLn "Pandoc detected"
but this works on Linux:
{- stack script
--verbose
--snapshot lts-21.25
-}
import System.Console.ANSI
main :: IO ()
main = putStrLn "ansi-terminal detected"
as does this (stack
is quite a large package, in terms of modules and dependencies):
{- stack script
--verbose
--snapshot lts-21.25
-}
import Paths_stack -- From stack package
main :: IO ()
main = print version
EDIT: There does not seem to be a problem with ‘normal’ builds of pandoc
; it seems to be something with runghc
which (I believe) uses the interactive mode of GHC ‘under the hood’. My tests of ‘normal’ builds have used:
package.yaml
:
name: example
version: 1.0.0
dependencies:
- base
- pandoc
executables:
example:
main: example.hs
example.hs
:
module Main ( main ) where
import Text.Pandoc
main :: IO ()
main = print pandocVersion
stack.yaml
snapshot: lts-21.25 # GHC 9.4.8
and varying the snapshot at the command line.