Haskell: Difference between revisions

Crasm (talk | contribs)
Scripting: Swap (legacy?) `haskellPackages.ghcWithPackages` for `ghc.withPackages` and add better starting examples for shell scripting with Haskell, using `Shh` in addition to `Turtle`.
This flow chart is wrong or at least so much oversimplified that it is actively misleading
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:


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


{{Note|{{nixos:package|haskellPackages}} 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.compiler.ghc884</code> to use GHC 8.8.4. You can get the full list of available GHC versions using:
{{Note|{{nixos:package|haskellPackages}} 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.compiler.ghc884</code> to use GHC 8.8.4. You can get the full list of available GHC versions using:
Line 39: Line 35:
     ...
     ...
     (ghc.withPackages (hsPkgs: with hsPkgs; [
     (ghc.withPackages (hsPkgs: with hsPkgs; [
       turtle   # Faster startup time with all external shell commands
       turtle     # Faster startup time with all external shell commands
       shh     # Piping operators and other goodies
       shh         # Piping operators and other goodies
       ...     # ...anything else you want!
      shh-extras  # Try shh as an interactive shell
       ...         # ...anything else you want!
     ])
     ])
   ];  
   ];