Haskell: Difference between revisions
→Using haskell-flake (flake-parts): Update links and include instructions on getting started |
m Add category haskell, link to other pages |
||
Line 21: | Line 21: | ||
[[File:haskell_choice.png]] | [[File:haskell_choice.png]] | ||
Note that in the following, | Note that in the following, {{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: | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
Line 46: | Line 46: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Read | To write inline Haskell scripts in nix-code, refer to [[Nix-writers#Haskell]]. | ||
Read [[#Overrides]] if some packages are broken. | |||
=== Directly using cabal (no nix caching/reproducibility) === | === Directly using cabal (no nix caching/reproducibility) === | ||
Line 210: | Line 212: | ||
=== Using haskell-flake (flake-parts) === | === Using haskell-flake (flake-parts) === | ||
[https://community.flake.parts/haskell-flake haskell-flake] aims to simplify writing Nix for Haskell development through use of [ | [https://community.flake.parts/haskell-flake haskell-flake] aims to simplify writing Nix for Haskell development through use of [[Flake Parts|flake-parts module system]]. It uses <code>callCabal2nix</code> and <code>shellFor</code> under the hood while exposing friendly module options API. | ||
* For existing Haskell projects, initialize with: | * For existing Haskell projects, initialize with: | ||
Line 322: | Line 324: | ||
== Limitations == | == Limitations == | ||
When using the <code>cabal2nix</code> tool, Nix does not pull a cabal package by respecting the constraint specified in the cabal file (see [https://github.com/chrissound/Cabal2NixLimitationExample example]). Issue is discussed [https://stackoverflow.com/questions/57441156/pulling-in-specific-haskell-packages-cabal-dependencies-with-nix here]. You should be using | When using the <code>cabal2nix</code> tool, Nix does not pull a cabal package by respecting the constraint specified in the cabal file (see [https://github.com/chrissound/Cabal2NixLimitationExample example]). Issue is discussed [https://stackoverflow.com/questions/57441156/pulling-in-specific-haskell-packages-cabal-dependencies-with-nix here]. You should be using <code>callCabal2nix</code> anyway. | ||
== IFD and Haskell == | == IFD and Haskell == | ||
Line 332: | Line 334: | ||
[[Category:Languages]] | [[Category:Languages]] | ||
[[Category:Haskell]] |