Haskell: Difference between revisions

imported>Tobias.bora
No edit summary
imported>Tobias.bora
No edit summary
Line 17: Line 17:
== How to develop with Haskell and Nix ==
== How to develop with Haskell and Nix ==


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. Below is an image to help you in your choice:
 
[[File:haskell_choice.png]]


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:
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:
Line 169: Line 171:
</syntaxhighlight>
</syntaxhighlight>


=== haskell.nix (for complexe projects) ===
=== Using haskell.nix (for complex projects) ===


The [https://github.com/input-output-hk/haskell.nix haskell.nix] project allows you to have maximum flexibility (to create your own package set or use in teams with diverse people, some of them using stack, other using cabal, other using nix…). But this comes at the price of an additional complexity.
The [https://github.com/input-output-hk/haskell.nix haskell.nix] project allows you to have maximum flexibility (to create your own package set or use in teams with diverse people, some of them using stack, other using cabal, other using nix…). But this comes at the price of an additional complexity.