Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't cabal install hunit

Very new to the Haskell ecosystem here. I'm trying to install hunit but when I run cabal install hunit I get the following message:

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'.
like image 694
doctopus Avatar asked Sep 21 '25 01:09

doctopus


1 Answers

This message is telling you two different things. "Install" is a legacy command and "hunit" does not exist.

Your short solution is cabal v2-install --lib HUnit. For a legacy behavior consider cabal v1-install HUnit.

install is legacy: The big paragraph

Cabal used to install everything into a single store, either user or system wide, and if any package ever disagreed on package version then good luck. The v2 commands move to a "nix style build" where different versions can co-exist in the store and projects can continue to benefit by sharing builds for common packages. The v2 commands are literally the commands prefixed with v2-, such as v2-install, v2-build and v2-configure.

hunit does not exist

Hackage is case sensitive. The tool already informed you that you might have intended to install HUnit instead of hunit.

Epilog: Use --lib

The v2-install does not expose the built libraries unless installed explicitly via --lib. This reduces namespace clutter at some expensive of us programmers needing to retrain. To use HUnit as a library and play with it in the repl, add --lib as shown at the beginning.

like image 124
Thomas M. DuBuisson Avatar answered Sep 23 '25 00:09

Thomas M. DuBuisson