我正在使用runhaskell
构建简单脚本,并尝试使用FastString
中的ghc-7.10.2
。简单地:
import FastString
main = putStrLn "Hello SO"
使用runhaskell Main.hs
运行会导致错误:
Main.hs:1:8:
Could not find module ‘FastString’
It is a member of the hidden package ‘ghc-7.10.2’.
Use -v to see a list of the files searched for.
我知道我可以使用cabal
构建它并指定ghc
作为依赖项,但我确实需要使用runhaskell
。
如何使用runhaskell
取消隐藏ghc库?
答案 0 :(得分:5)
<强> TL; DR:强>
$ ghc-pkg expose ghc
好吧,runhaskell
基本上是runghc
的包装,而runghc
基本上是ghc
。所有这些规则都遵循相同的规则:它们只能从配置的数据库中导入公开的包。
使用ghc-pkg describe {package-name}
,可以获得有关某个包的信息。这里重要的字段是exposed
:
$ ghc-pkg describe ghc | grep expose
exposed: False
exposed-modules:
正如您所看到的,包裹未被暴露(因此它被隐藏)。使用ghc-pkg expose
,您可以取消隐藏它:
$ ghc-pkg expose ghc
请注意,如果您要更改系统范围的数据库数据库的设置,则需要权限。