BSD-3-Clause licensed by Peter Simons
Maintained by [email protected]
This version can be pinned in stack with:language-nix-2.3.0@sha256:dd28fd47564c8dfefcb7225c4f151540890069ceac60686263b59ade6a9c5379,1668

Module documentation for 2.3.0

Used by 2 packages in nightly-2025-11-21(full list with versions):

language-nix

hackage release stackage LTS package stackage Nightly package travis build status

This Haskell library contains data types and useful functions to represent and manipulate the Nix language. It is used by tooling like cabal2nix and is not meant to be a general purpose nix parser or even interpreter. Have a look at hnix (in Haskell) or nix (the original in C++) instead.

Changes

Revision History for language-nix

2.3.0

  • Language.Nix.Identifier now exports nixKeywords which lists keywords in Nix that are parseable as simple identifiers, but have special meaning, like assert and with. Consequently, they can’t be used as (simple) identifiers in Nix code.

    quote, needsQuoting and Pretty will take this list into account and quote such identifiers. However, HasParser will not reject them even if they are unquoted.

  • Resolved discrepancies between Language.Nix.Identifier and Nix w.r.t. quoting and escaping:

    • Fixed missing escaping of some Nix syntax elements, e.g. in the case of ident # "${foo}".
    • Pretty printing Identifiers will no longer produce escape sequences Haskell supports, but Nix doesn’t.
    • Parsing Identifiers won’t interpret escape sequences that Nix wouldn’t understand.
  • Added an hspec/QuickCheck based test suite.