Skip to content

Latest commit

 

History

History
411 lines (369 loc) · 22 KB

PACKAGES.md

File metadata and controls

411 lines (369 loc) · 22 KB

Running Cabal on Windows

Haskell project This document gathers usage information on running Cabal, a system for packaging and installing Haskell libraries and programs, on a Windows machine.

Useful Haskell packages are for instance :

🔎 Do not forget to execute command cabal update before running list and install :

> cabal update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
   cabal v2-update 'hackage.haskell.org,2021-08-21T05:55:43Z'

cabal-install installation

We install cabal-install as follows 1 :

> cabal install cabal-install
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - Cabal-syntax-3.10.1.0 (lib) (requires download & build)
[...]
Starting     cabal-install-3.10.1.0 (exe:cabal)
Building     cabal-install-3.10.1.0 (exe:cabal)
Installing   cabal-install-3.10.1.0 (exe:cabal)
Completed    cabal-install-3.10.1.0 (exe:cabal)
Copying 'cabal.exe' to '%APPDATA%\cabal\bin\cabal.exe'
 
> cabal --version
cabal-install version 3.10.1.0
compiled using version 3.10.1.0 of the Cabal library
 
> echo %CABAL_DIR%
%APPDATA%\cabal

We now have two cabal.exe installed after running the above command :

That means we have to carefully set up our PATH variable so that %CABAL_DIR%\bin 2 appears before %GHC_HOME%\bin (another option would be to remove %GHC_HOME%\bin\cabal.exe).

haskell-language-server installation

haskell-language-server is a LSP server for GHC (changelog).

> cabal list haskell-language-server
* haskell-language-server
    Synopsis: LSP server for GHC
    Default available version: 1.10.0.0
    Installed versions: [ Not installed ]
    Homepage: https://github.com/haskell/haskell-language-server#readme
    License:  Apache-2.0
 
> cabal install haskell-language-server
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - Diff-0.4.1 (lib) (requires download & build)
[...]

hlint installation

HLint is a tool for suggesting possible improvements to Haskell source code (changelog).

We install hlint as follows.

> cabal list hlint | head -6
* hlint
    Synopsis: Source code suggestions
    Default available version: 3.5
    Installed versions: [ Not installed ]
    Homepage: https://github.com/ndmitchell/hlint#readme
    License:  BSD3
 
> cabal install --overwrite-policy=always hlint
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
[...]
 - hlint-3.8 (lib) (requires download & build)
 - hlint-3.8  (exe:hlint) (requires download & build)
Downloading  hlint-3.8 
Downloaded   hlint-3.8 
Starting     hlint-3.8  (lib)
Building     hlint-3.8  (lib)
Installing   hlint-3.8  (lib)
Completed    hlint-3.8  (lib)
Starting     hlint-3.8  (exe:hlint)
Building     hlint-3.8  (exe:hlint)
Installing   hlint-3.8  (exe:hlint)
Completed    hlint-3.8  (exe:hlint)
Warning: installdir is not defined. Set it in your cabal config file or use
--installdir=<path>. Using default installdir:
"%APPDATA%\\cabal\\bin"
Copying 'hlint.exe' to '%APPDATA%\cabal\bin\hlint.exe'

hpack installation

Hpack is a format for Haskell packages (changelog).

Similarly to hlint we install hpack as follows.

> cabal list hpack | head -6
* hpack
    Synopsis: A modern format for Haskell packages
    Default available version: 0.35.2
    Installed versions: [ Not installed ]
    Homepage: https://github.com/sol/hpack#readme
    License:  MIT
 
> cabal install --overwrite-policy=always hpack
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
[...]
Starting     hpack-0.35.2 (lib)
Building     hpack-0.35.2 (lib)
Installing   hpack-0.35.2 (lib)
Completed    hpack-0.35.2 (lib)
Starting     hpack-0.35.2 (exe:hpack)
Building     hpack-0.35.2 (exe:hpack)
Installing   hpack-0.35.2 (exe:hpack)
Completed    hpack-0.35.2 (exe:hpack)
Warning: installdir is not defined. Set it in your cabal config file or use
--installdir=<path>. Using default installdir:
"%APPDATA%\\cabal\\bin"
Copying 'hpack.exe' to '%APPDATA%\cabal\bin\hpack.exe'

hspec installation

[Hspec] is a testing framework for Haskell (changelog). Note the mandatory --lib option.

> cabal list hspec-core | head -6
* hspec-core
    Synopsis: A Testing Framework for Haskell
    Default available version: 2.11.0.1
    Installed versions: [ Not installed ]
    Homepage: http://hspec.github.io/
    License:  MIT
 
> cabal install --overwrite-policy=always --lib hspec
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
[...]
 - hspec-core-2.11.0.1 (lib) (requires download & build)
 - hspec-2.11.0.1 (lib) (requires download & build)
[...]
Starting     hspec-2.11.0.1 (lib)
Building     hspec-2.11.0.1 (lib)
Installing   hspec-2.11.0.1 (lib)
Completed    hspec-2.11.0.1 (lib)

HTF installation

HTF (Haskell Test Framework) lets you define unit tests, QuickCheck properties, and black box tests in an easy and convenient way.

> cabal install HTF
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - cpphs-1.20.9.1 (exe:cpphs) (requires build)
[...]
 - HTF-0.15.0.0 (lib:HTF, exe:htfpp) (requires download & build)
Starting     HTF-0.15.0.0 (all, legacy fallback)
Building     HTF-0.15.0.0 (all, legacy fallback)
Installing   HTF-0.15.0.0 (all, legacy fallback)
Completed    HTF-0.15.0.0 (all, legacy fallback)
Warning: installdir is not defined. Set it in your cabal config file or use
--installdir=<path>. Using default installdir:
%APPDATA%\\cabal\\bin"
Copying 'htfpp.exe' to '%APPDATA%\cabal\bin\htfpp.exe'

HUnit installation

HUnit is a unit testing framework for Haskell, inspired by the JUnit tool for Java (changelog). Note the mandatory --lib option.

> cabal list hunit | head -6
* HUnit
    Synopsis: A unit testing framework for Haskell
    Default available version: 1.6.2.0
    Installed versions: [ Not installed ]
    Homepage: https://github.com/hspec/HUnit#readme
    License:  BSD3
 
> cabal install --lib HUnit
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - call-stack-0.3.0 (lib) (requires download & build)
 - HUnit-1.6.2.0 (lib) (requires download & build)
Downloading  call-stack-0.3.0
Downloaded   call-stack-0.3.0
Downloading  HUnit-1.6.2.0
Starting     call-stack-0.3.0 (lib)
Downloaded   HUnit-1.6.2.0
Building     call-stack-0.3.0 (lib)
Installing   call-stack-0.3.0 (lib)
Completed    call-stack-0.3.0 (lib)
Starting     HUnit-1.6.2.0 (lib)
Building     HUnit-1.6.2.0 (lib)
Installing   HUnit-1.6.2.0 (lib)
Completed    HUnit-1.6.2.0 (lib)

ormolu installation

ormolu is a formatter for Haskell source code (changelog).

> cabal list ormolu
* ormolu
    Synopsis: A formatter for Haskell source code
    Default available version: 0.6.0.1
    Installed versions: [ Not installed ]
    Homepage: https://github.com/tweag/ormolu
    License:  BSD-3-Clause
 
> cabal install --overwrite-policy=always ormolu
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - Cabal-3.6.3.0 (lib) (requires download & build)
 - base-compat-0.12.1 (lib) (requires download & build)
 - ghc-lib-parser-9.2.1.20211101 (lib) (requires download & build)
[...]
 - ormolu-0.5.2.0 (exe:ormolu) (requires download & build)
Downloading  ormolu-0.6.0.1
[...]
Starting     ormolu-0.6.0.1 (lib)
Building     ormolu-0.6.0.1 (lib)
Installing   ormolu-0.6.0.1 (lib)
Completed    ormolu-0.6.0.1 (lib)
Starting     ormolu-0.6.0.1 (exe:ormolu)
Building     ormolu-0.6.0.1 (exe:ormolu)
Installing   ormolu-0.6.0.1 (exe:ormolu)
Completed    ormolu-0.6.0.1 (exe:ormolu)
Warning: installdir is not defined. Set it in your cabal config file or use
--installdir=<path>. Using default installdir:
"%APPDATA%\cabal\\bin"
Copying 'ormolu.exe' to
'%APPDATA%\cabal\bin\ormolu.exe'
 
> ormolu --version
ormolu 0.6.0.1 UNKNOWN UNKNOWN
using ghc-lib-parser 9.2.2.20220307

Footnotes

[1] 1st installation of cabal.exe

Windows users can download the Zip archive cabal-install-XXXX-x86_64-unknown-mingw32.zip and put cabal.exe somewhere on %PATH% (in our case C:\opt\ghc-8.10.7\bin\).
> where cabal
C:\opt\ghc-8.10.7\bin\cabal.exe
 
> cabal update
Config file path source is default config file.
Config file %APPDATA%\cabal\config not found.
Writing default configuration to %APPDATA%\cabal\config
Downloading the latest package list from hackage.haskell.org
 
> echo %CABAL_DIR%
%APPDATA%\cabal

[2] Variable CABAL_DIR

The CABAL_DIR variable defines where the cabal command will install the software packages.
> dir /b %CABAL_DIR%\store\
ghc-8.10.4
ghc-8.10.5
ghc-8.10.6
ghc-8.10.7
ghc-9.0.1
For version GHC 8.10.7, installed packages whose name starts with letter h are:
> dir /b %CABAL_DIR%\store\ghc-8.10.7\package.db\h*
hackage-secur_-0.6.2.0-4bcfc91bab3c9672887242ecd330bcd74353fb3a.conf
haddock-libra_-1.10.0-75d854e07f5a0b27babf51cc17072e68eb6e245e.conf
hashable-1.3.5.0-65bc77b538ac7d072f1fcd030b6ee6a57e0b26c4.conf
hashtables-1.2.4.2-f4d494972092c75e404f02da79d84e1f242dfbf7.conf
haskell-langu_-1.6.1.0-f31acb97be2fbd5fed0b7e021cff339e3c175d6c.conf
haskell-src-e_-1.23.1-4440c55b672a41bb11a00f76ff75f45612ae1cd4.conf
heapsize-0.3.0.1-27572f5939b1d90b9cb6eddd909b80e8cc943471.conf
hie-bios-0.8.1-d6478efe291f7474286ad3633a2b3625ddbd4cff.conf
hie-compat-0.2.1.1-3d80479a30af4ccfe5285e11884b258270cf5da5.conf
hiedb-0.4.1.0-f92bc53bbba3b57bf3a8e19b79d25ef9e66b449a.conf
hlint-3.2.8-07a017a8a2bca5a63749ab6686cca487f10a8038.conf
[...]
hscolour-1.24.4-0061dbe6d18e3cd673fce03ea0660dc5aaea655c.conf
hslogger-1.3.1.0-ee928afffd7ec0713310f830500c93fbd2f8c290.conf
hspec-2.9.4-630a6b50002ab7a0f91aaaeb68c05dff9fad57b5.conf
hspec-core-2.9.4-5d423483180beed29c5cb7bd5432d1296f6e3127.conf
hspec-discover-2.9.4-c1877178bbde3b2ac7c7a39dcf35b3e17924ad6c.conf
hspec-expecta_-0.8.2-298fc3d376661a3415ebc3ea5fb2e5c975cc9f9b.conf
HsYAML-0.2.1.0-07ad9aac91ccaff8e81e57b0c2b3f7c41d13eb79.conf
HsYAML-aeson-0.2.0.1-566689edb1c87f23b9e83ca7a4f7206983c56ccd.conf
HTTP-4000.3._-a14a8e673826c92e06e8f90d8b92ed1ad00f6951.conf
HUnit-1.6.2.0-7584a845e4464486d878b49a7f17ebf7806dc12b.conf
hyphenation-0.8.2-bd515ef41c0e7481a693cfb43a634ffee182525d.conf

mics/November 2024