简体   繁体   English

如何使用Runhaskell取消隐藏ghc库

[英]How can I unhide ghc library using runhaskell

I'm building simple script with runhaskell and I try to use FastString from ghc-7.10.2 . 我正在使用runhaskell构建简单的脚本,并且尝试使用ghc-7.10.2 FastString Simply: 只是:

import FastString

main = putStrLn "Hello SO"

running it with runhaskell Main.hs results in error: 使用runhaskell Main.hs运行它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.

I know that I can build it with cabal and specify ghc as dependency, but I really need to do it with runhaskell . 我知道我可以使用cabal来构建它,并将ghc指定为依赖项,但是我确实需要使用runhaskell来实现。

How can I unhide ghc library using runhaskell ? 如何使用runhaskell取消隐藏ghc库?

TL;DR: TL; DR:

$ ghc-pkg expose ghc

Well, runhaskell is basically a wrapper around runghc , and runghc is basically ghc . 那么, runhaskell基本上是围绕着包装runghcrunghc基本上是ghc All of them follow the same rules: they can only import exposed packages from your configured database. 它们都遵循相同的规则:它们只能从配置的数据库中导入公开的软件包。

Using ghc-pkg describe {package-name} , one can get information about a certain package. 使用ghc-pkg describe {package-name} ,可以获得有关某个软件包的信息。 The important field here is exposed : 这里的重要领域是exposed

$ ghc-pkg describe ghc | grep expose
exposed: False
exposed-modules:

As you can see, the package isn't exposed (therefore it's hidden). 如您所见,该程序包没有暴露(因此是隐藏的)。 Using ghc-pkg expose , you can unhide it: 使用ghc-pkg expose ,您可以取消隐藏它:

$ ghc-pkg expose ghc

Keep in mind that you need permissions if you're changing the settings of your system wide package database. 请记住,如果要更改系统范围的软件包数据库的设置,则需要权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM