Real "Real World PureScript"

From time to time people ask for “real world” examples of PureScript projects. Usually we link out to one of the toy projects built specifically to demonstrate minimal but realistic applications like these:

However, I wanted to call out a few applications that are indeed “real world” in the sense they are PureScript applications built for a non-teaching purpose. (I’ll of course skip the many private PureScript codebases such as our own at Arista Networks!)

I may be biased, but I think one of the best is the PureScript registry. Among other things, it demonstrates:

  • Implementing server-side PureScript on top of Node
  • Using run as its effects system instead of the typical MTL style seen in e.g. Real World Halogen (see the App.Effect directory).
  • A monorepo built using the new Spago, with a library the community can use in addition to an application
  • A full suite of tests using spec, including for the registry library, bindings to foreign libraries, and the main application. One of my favorite tests runs a full publish pipeline using the exact code from the app, but with the implementation swapped out via run.
  • Speaking of the foreign libraries, you’ve got plenty of examples of writing FFI in this project under the foreign directory. Including the messy real-world stuff!
  • Everything is packaged up with Nix; we run integration tests with the exact code we intend to push to production on each PR and on commits to the main branch we auto-deploy to the server.
  • It’s incomplete, but there’s a spec that can help you get oriented.

The registry is one example, but there are many open-source tools written in PureScript you can take a look at for real-world inspiration. Some of these include:

  • Spago, the PureScript package manager. Once again you see a significant PureScript monorepo with plenty of tests and some messy real-world code to work around things like Windows support. Spago targets both a CLI tool and the browser, as it provides a local docs-search UI similar to that of Pursuit.
  • purs-tidy, the PureScript code formatter. This one is especially interesting internally because of all the work done to parse, understand, format, and print PureScript code.
  • insect, a fairly popular high-precision scientific calculator. The author is primarily a Rust developer and recently embarked on a redesign / rewrite from scratch in Rust, but the code is still reasonably up to date and an interesting read.

I’m sure there are more out there, but these are some highlights! If you know of more significant tools that are open source please feel free to share them as well.

22 Likes

Fluid is a full (untyped) functional programming language implemented in PureScript, with a d3.js front end. We’ve been working on it for 3+ years and PureScript has been instrumental to making the dev workflow enjoyable and robust.

5 Likes
  • Cardano-transaction-lib is a transaction builder that leverages chain-indexes and RPC bridges to bring Cardano (Extended UTXO) smart contract interfaces to the browser. we’re using it in PlutusExperience, nix-templates and Fourier Labs to build an EVM compatible bridge.
  • Evo-Siigo is an integration that I created a few months ago for two different proprietary CRMs (EVO and Siigo) using the temporal.io framework running on top of Node.js. It essentially employs deterministic transactions to ensure a fault-tolerant service with some advanced features, such as a dashboard for monitoring activities.
1 Like

At Gargantext we have a pretty big frontend written entirely in PureScript with our own reactix interface to React.

3 Likes

I’ve been using Transity (YAML based plain text accounting tool) for all my personal and my companies finances for years! :grin:

2 Likes

PS is heavily used within the Cardano ecosystem[0], in particular, Indigo Protocol[1] uses it, among others[2]

[0] GitHub - klntsky/cardano-purescript: Overview of PureScript libraries/tools for Cardano
[1] Indigo Protocol · GitHub
[2] GitHub - Plutonomicon/cardano-transaction-lib: A Purescript library for building smart contract transactions on Cardano

5 Likes