Haskell: Difference between revisions

imported>Tobias.bora
No edit summary
imported>Tobias.bora
No edit summary
Line 1: Line 1:
== Introduction ==
== Introduction ==


[https://www.srid.ca/haskell-nix '''Nix recipes for Haskellers'''] aims to get a beginner comfortable managing simple Haskell programs and projects using Nix.
[https://www.srid.ca/haskell-nix '''Nix recipes for Haskellers'''] aims to get a beginner comfortable managing simple Haskell programs and projects using Nix.  


== FAQ and resources ==
== FAQ and resources ==
* [https://haskell4nix.readthedocs.io/ The official documentation] (the [https://nixos.org/manual/nixpkgs/stable/#haskell manual] directly points to this ressource)


* [https://discourse.nixos.org/t/haskellpackages-stm-containers-fails-to-build/5416/4?u=srid '''How are Haskell packages managed in nixpkgs?''']
* [https://discourse.nixos.org/t/haskellpackages-stm-containers-fails-to-build/5416/4?u=srid '''How are Haskell packages managed in nixpkgs?''']
Line 16: Line 18:


There are multiples ways to develop in Haskell on Nix depending on the simplicity of the project and on whether one want to benefit from the reproducibility offered by nix or not.
There are multiples ways to develop in Haskell on Nix depending on the simplicity of the project and on whether one want to benefit from the reproducibility offered by nix or not.
Note that in the following, <code>haskellPackages</code> is a synonym of <code>haskell.packages.ghcXYZ</code> where <code>XYZ</code> is the current default version of GHC in nixpkgs. However you can use a different version by replacing <code>haskellPackages</code> with the wanted package, for instance use <code>haskell.packages.ghc884</code> to use GHC 8.8.4. You can get the full list of available GHC versions using:
<syntaxhighlight lang="bash">
$ nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
haskell.compiler.ghc8107                ghc-8.10.7
haskell.compiler.ghc884                  ghc-8.8.4
haskell.compiler.ghc902                  ghc-9.0.2
haskell.compiler.ghc924                  ghc-9.2.4
haskell.compiler.ghcHEAD                ghc-9.3.20220406
haskell.compiler.ghc942                  ghc-9.4.2
</syntaxhighlight>


=== Scripting ===
=== Scripting ===