Open tonicebrian opened 5 days ago
This doesn't happen with the latest resolver.
#!/usr/bin/env stack
- {- stack script --resolver lts-21.25 --package pandoc -}
+ {- stack script --resolver nightly-2024-06-22 --package pandoc -}
import Prelude
import Text.Pandoc
main :: IO ()
main = putStrLn "Pandoc detected"
$ ./example.hs
Pandoc detected
For me it doesn't work neither with lts-21.25
nor lts-22.26
. I cannot go for nightly because that would involve changing the GHC compiler. Should I file an issue in LTS?
@tonicebrian, thanks for reporting. I'm looking into this.
Related discussion: https://discourse.haskell.org/t/stack-script-fails-to-find-pandoc/9817/9
@tonicebrian, I think this is - at least, in part - an issue with GHC's runghc
, and I have opened: https://gitlab.haskell.org/ghc/ghc/-/issues/25035.
My reasoning is that (on Windows):
❯ stack --snapshot lts-21.21 exec -- runghc -hide-all-packages -package=base -package=pandoc example1.hs
example1.hs:6:1: error:
Could not load module ‘Text.Pandoc’
It is a member of the hidden package ‘pandoc-3.0.1’.
You can run ‘:set -package pandoc’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
6 | import Text.Pandoc
| ^^^^^^^^^^^^^^^^^^
shoud not be a possible output of runghc
. The very purpose of -package=pandoc
is to expose pandoc
.
(This is not Linux-specific but, oddly, GHC 9.4.7 works on Linux, fails on Windows and GHC 9.4.8 fails on Linux, works on Windows - all with pandoc-3.0.1
.)
General summary/comments (optional)
Stack used as a script fails to find pandoc library although it has been downloaded and compiled.
Steps to reproduce
Just run this script:
Expected
I would expect the "Pandoc detected" printed in screen
Actual
The script fails to compile with:
Stack version
Method of installation
Platform
Linux Ubuntu 22.04