Strange Loop

2009 - 2023

/

St. Louis, MO

PureScript (Maybe This Time We Get JavaScript Right)

The web browser is the world's most ubiquitous user interface. Sadly, this means we're all basically stuck in an abusive relationship with JavaScript. Obviously not a desirable position to find ourselves in, we've tried breaking out of the JS trap in a variety of ways: JS dialects (solving no design flaws but at least looking prettier) and JS as a compilation target (resulting, mostly, in unappealingly large output to support the emulated runtimes).

So when I found myself having to build a system with real deliverable size constraints, my only options seemed to be JS itself, or TypeScript, which doesn't add much to JS but at least provides a modicum of type checking. After a few months of fighting TypeScript, though, I'd had enough. Happily, my frustration coincided with the advent of PureScript.

At first glance, PureScript looks and feels like Haskell, but there's hardly any extraneous machinery. The PureScript compiler generates very concise JS, and the language itself is designed with the platform's constraints in mind. Yet it offers things like higher kinded polymorphism, type classes and similar deep Haskell magic. More appealingly, it comes with a growing number of libraries for coping with the browser as a platform: functional DOM manipulation, reactive programming, and more.

It turned out to be a delight, getting out of my tangled mess of JavaScript and rebuilding it all in PureScript, and I'd like to show you how and why.

Bodil Stokke

Bodil Stokke

Future Ad Labs

Bodil is a compulsive conference speaker in the fields of functional programming and internets technologies, and is a co-organiser of multiple developer conferences in Scandinavia and the UK, mostly because she’s still learning how to stop. She is a prolific contributor to the Free Software community, and has recently taken up designing new programming languages as a hobby. In her spare time, she works as a developer for Future Ad Labs, a London based startup that wants to make advertising a productive member of society. Her favourite pony is Pinkie Pie.