【发布时间】:2008-09-26 20:37:57
【问题描述】:
我知道一个 Haskell 模块名称,但我不知道它是在哪个包中定义的。这很糟糕,因为我无法在没有暴露此模块的包的情况下进行编译。
具体是我找不到的 Text.Regex,但我想知道如何解决这个问题。
【问题讨论】:
我知道一个 Haskell 模块名称,但我不知道它是在哪个包中定义的。这很糟糕,因为我无法在没有暴露此模块的包的情况下进行编译。
具体是我找不到的 Text.Regex,但我想知道如何解决这个问题。
【问题讨论】:
http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html
ghc-pkg find-module Text.Regex
但这仅适用于 (a) 最近的 GHC,以及 (b) 安装在您系统上的软件包。
您还可以通过 grep 搜索包文件(例如 /usr/lib/ghc-6.8.2/package.conf)来查看安装的内容。
您也可以使用haskell API 搜索引擎hoogle 或hackage 搜索引擎hayoo。
Text.Regex 在 regex-base 包中,还有一些其他的构建在它之上。
【讨论】:
如果你使用 Cabal 并且安装了包,你可以尝试使用 cabal build 编译它,Cabal 会通知你忘记添加哪个包到你的依赖项:
Main.hs:1:8:
Could not find module `Text.Regex':
It is a member of the hidden package `regex-compat-0.93.1'.
Perhaps you need to add `regex-compat' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
【讨论】:
如果您使用 Debian 和 Debian 提供的软件包,在/usr/share/doc/ghc-doc/html/libraries/index.html 有一个全球文档索引,该索引在最后一列中列出了软件包。
【讨论】: