Who Would Find PureNix Easy to Use?


This post is the second post in a series about PureNix. The previous post is about getting started with PureNix. The next post is about why we started writing PureNix.

PureNix will be easy to get started with for developers that have a good understanding of both Haskell-like languages and Nix. Developers without this background will have some trouble using PureNix.

This blog post gives some suggestions about how developers with different knowledge sets may want to approach PureNix.

Developers that Know Haskell, PureScript, and Nix

If you have experience with Haskell, PureScript, and Nix, PureNix will be easy to get started with. PureNix should feel quite natural.

There are two things you may want to keep in mind:

  • You may have to write some FFI for Nix builtins.

    Here's an example PureScript module that defines some Nix builtins, as well as the underlying FFI code.

  • Nix is a pure language, so there is nothing like Haskell's IO type or PureScript's Effect type in PureNix1. The fact that you can have all your functions be pure in PureScript works out really nicely with PureNix and Nix.

Developers that Know PureScript and Nix (but not Haskell)

If you have experience with PureScript and Nix (but no experience with Haskell), PureNix should still be pretty easy. Unlike the main JavaScript backend for PureScript, PureNix is lazy. This will feel a little weird at first, but since you already know Nix, it shouldn't be too difficult.

There are also a few type-classes in PureScript that aren't necessary in PureNix, like:

Developers that Know Haskell and Nix (but not PureScript)

If you have experience with Haskell and Nix (but not PureScript), it might take you a little bit of time to get used to the PureScript standard library. But other than that, you shouldn't have many problems.

In general, PureScript is split up into a large number of small packages and modules, much more so than Haskell. For example, Maybe and Either live in completely separate packages. They are not included the Prelude:

There are many common data-types and functions that are in their own packages. But most data-types and functions are named similarly to their counterparts in Haskell, so you shouldn't have much trouble in practice. You'll likely find the following resources very useful:

  • Pursuit. A combination of a search engine like Hoogle, and API documentation like Hackage (but for PureScript instead of Haskell).2
  • Differences from Haskell. Official documentation on the differences between PureScript and Haskell.
  • Language Documentation. Official documentation on the PureScript language. You'll likely want to focus on the document about Records, since they are one of the main differences between PureScript and Haskell.

Developers that Know Haskell or PureScript (but not Nix)

If you have experience with Haskell or PureScript (but not Nix), you may have some trouble getting started. It may be a little early to attempt to use PureNix. You would likely benefit from first reading the Nix Manual.

Nix feels like a simple lambda calculus (along with some built-in types and functions), so if you're already familiar with a Haskell-like language, it shouldn't take you that long to learn Nix. Although, learning Nixpkgs is much more time-consuming.

Developers that Know Nix (but not Haskell or PureScript)

If you have experience with Nix (but not Haskell or PureScript), you will likely have trouble getting started with PureNix. I would recommend first trying to learn Haskell or PureScript. If your goal is to use PureNix, then it doesn't really matter if you first learn Haskell or PureScript, since they are so similar. Haskell seems to have more beginner-oriented resources than PureScript.

Keep in mind that like Nix, Haskell and PureScript have a steep learning curve. Becoming proficient in Haskell or PureScript can be quite time-consuming.

Here are a few resources I've heard people recommend:

You would probably benefit from doing a Google search on the most recommended learning materials.


PureNix should be easy to get started with if you know Haskell/PureScript and Nix. You may have a harder time if you're new to either Haskell-like languages, or Nix.

This post is the second post in a series about PureNix. The previous post is about getting started with PureNix. The next post is about why we started writing PureNix.

Using PureNix Professionally

If your company is considering PureNix in order to tame a complicated Nix codebase, Jonas and I currently have time available for consulting or freelance. Feel free to get in touch. We are also available for any other Nix/Haskell/PureScript-related work.

  1. We had some discussion about this on GitHub, and it turns out there may be some good reasons for using an IO or Effect-like type in PureNix.↩︎

  2. Pursuit doesn't know anything about PureNix, but the API of the PureNix libraries that have been ported so far is almost the same as the PureScript version of the libraries, so searching for functions on Pursuit is still helpful. In the future it would be nice if there was a Pursuit specifically for PureNix.↩︎

tags: purescript, nixos, haskell