I'm trying to learn how to use Haskell, but I've run into a little roadblock. I'm using MacOSX 10.12.6 and installed Haskell Platform using:
$ brew cask install haskell-platform
with no modifications. When I try to compile a program with parsec
imported, Haskell-Platform can't find it:
$ ghc -v test.hs
...
package parsec-3.1.11-DPgnR92AWEaFOaixmwipet is unusable due to shadowed dependencies:
mtl-2.2.1-19EL8AGBsN3DnnOhrC9xY3 text-1.2.2.2-EGUst8sqNAZCw1xLPcmcMH
...
test.hs:2:1: error:
Could not find module ‘Text.Parsec’
Locations searched:
Text/Parsec.hs
Text/Parsec.lhs
Text/Parsec.hsig
Text/Parsec.lhsig
|
2 | import Text.Parsec
| ^^^^^^^^^^^^^^^^^^
parsec is installed:
$ ghc-pkg list | grep -e 'parsec'
attoparsec-0.13.2.0
parsec-3.1.11
So I have a few questions:
- What does it mean by shadowed dependencies?
- Where does GHC look for libraries?
- Where does GHC look for user libraries vs system wide libraries?
- Can this path be modified?
There was a bug with 8.2.1 binary platform builds, and a new release was cut to fix the issue you encountered.
Details on the bug, and the new release are provided at https://mail.haskell.org/pipermail/haskell-cafe/2017-October/127979.html
来源:https://stackoverflow.com/questions/46500732/ghc-cannot-find-libraries-on-fresh-install-of-haskell-platform