首页 > 解决方案 > 无法阴谋集团安装 hunit

问题描述

这里的 Haskell 生态系统非常新。我正在尝试安装 hunit,但是当我运行时,cabal install hunit我收到以下消息:

Warning: The install command is a part of the legacy v1 style of cabal usage.

Please switch to using either the new project style and the new-install
command or the legacy v1-install alias as new-style projects will become the
default in the next version of cabal-install. Please file a bug if you cannot
replicate a working v1- use case with the new-style commands.

For more information, see: https://wiki.haskell.org/Cabal/NewBuild

cabal: There is no package named 'hunit'. However, the following package name
exists: 'HUnit'.

标签: haskellcabalhunit

解决方案


此消息告诉您两件不同的事情。“安装”是旧命令,“hunit”不存在。

您的简短解决方案是cabal v2-install --lib HUnit. 对于遗留行为,请考虑cabal v1-install HUnit.

install is legacy: 大段

Cabal 过去将所有内容安装到单个商店中,无论是用户范围还是系统范围,如果任何软件包在软件包版本上存在分歧,那么祝你好运。v2 命令移至“nix 样式构建”,其中不同版本可以在商店中共存,项目可以通过共享通用包的构建继续受益。v2 命令实际上是带有前缀的命令v2-,例如v2-install,v2-buildv2-configure

hunit 不存在

Hackage 区分大小写。该工具已经通知您,您可能打算安装HUnit而不是hunit.

结语:使用--lib

v2-install除非通过--lib. 这减少了一些需要重新培训的昂贵程序员的命名空间混乱。要将 HUnit 用作库并在 repl 中使用它,请--lib按开头所示添加。


推荐阅读