管理相关 Cabal 包的最佳实践是什么?

发布于 2024-08-28 06:23:00 字数 657 浏览 10 评论 0原文

我正在开发一个用 Haskell 编写的基于数据流的优化库。现在看来,该库可能必须分为两部分:

  • 具有最小构建依赖性的核心部分;称之为 hoopl-core

  • 一个完整的部分,称之为hoopl,它可能对 PrettyPrinter、QuickCheck 等包有额外的依赖。

这个想法是 Glasgow Haskell 编译器将仅依赖于 hoopl-core ,因此引导编译器不会太困难。其他编译器将在 hoopl 中获得额外的好处。包 hoopl 将依赖于 hoopl-core

Debian 软件包工具可以从单个源代码树构建多个软件包。不幸的是Cabal 还没有达到那种复杂程度。但肯定还有其他库或应用程序设计者也有类似的问题(例如,一个包用于核心库,另一个包用于命令行界面,另一个包用于 GUI 界面)。

使用 Cabal 构建和管理多个相关 Haskell 包的当前最佳实践是什么?

I'm working on a dataflow-based optimization library written in Haskell. It now seems likely that the library is going to have to be split into two pieces:

  • A core piece with minimal build dependencies; call it hoopl-core.

  • A full piece, call it hoopl, which may have extra dependencies on packages like a prettyprinter, QuickCheck, and so on.

The idea is that the Glasgow Haskell Compiler will depend only on hoopl-core, so that it won't be too difficult to bootstrap the compiler. Other compilers will get the extra goodies in hoopl. Package hoopl will depend on hoopl-core.

The Debian package tools can build multiple packages from a single source tree. Unfortunately Cabal has not yet reached that level of sophistication. But there must be other library or application designers out there who have similar issues (e.g., one package for a core library, another for a command-line interface, another for a GUI interface).

What are current best practices for building and managing multiple related Haskell packages using Cabal?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

享受孤独 2024-09-04 06:23:00

我将这两个包放在单独的子目录中,并有一个 Makefile ,其内容如下:

.PHONY: all hoopl hoop-core
all : hoopl

hoopl : hoopl-core
       cd hoopl && cabal build && cabal register --inplace

hoopl-core
       cd hoopl-core && cabal build && cabal register --inplace

这假设您已经通过首先构建 hoopl-core 并注册它来引导该过程(-- inplace),然后构建hoopl。您可以使用 Makefile 自动执行更多操作。

如您所知,当我们想要 GHC 的类似功能时,我们编写了自己的构建系统;-) 我不建议这样做。从技术上讲,我认为可以从 GHC 构建系统中提取所需的部分并制作一个可重用的框架,不过......

I'd put the two packages in separate subdirectories, and have a Makefile with something like this:

.PHONY: all hoopl hoop-core
all : hoopl

hoopl : hoopl-core
       cd hoopl && cabal build && cabal register --inplace

hoopl-core
       cd hoopl-core && cabal build && cabal register --inplace

this assumes you've bootstrapped the process by first building hoopl-core and registering it (--inplace) and then building hoopl. You could automate more of this using the Makefile.

As you know, when we wanted similar functionality for GHC, we wrote our own build system instead ;-) I don't recommend that. Technically I suppose it would be possible to extract from the GHC build system the required pieces and make a re-usable framework, though...

稳稳的幸福 2024-09-04 06:23:00

将这两个包放入源代码控制存储库的单独子目录中,并使用两个单独的 cabal 文件。

确保在移动文件时使用源代码管理系统的移动操作,以便它正确跟踪历史记录。

Put the two packages into separate subdirectories of your source control repo, and use two separate cabal files.

Make sure you use the move operation of your source control system when moving files, so that it tracks the history properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文