Est. 2013 Advanced

PureScript

A purely functional, strongly-typed language inspired by Haskell that compiles to readable JavaScript for building reliable web applications.

Created by Phil Freeman

Paradigm Purely functional
Typing Static, strong, inferred (Hindley-Milner style with type classes)
First Appeared 2013
Latest Version 0.15.16 (March 2026)

PureScript is a purely functional, strongly-typed programming language that compiles to JavaScript. Designed by Phil Freeman and first appearing in 2013, it brings the type-system rigor of Haskell to the web while producing output that is meant to be straightforward and readable. PureScript targets developers who want the safety and expressiveness of advanced functional programming — algebraic data types, type classes, and a powerful static type checker — without giving up the reach of the JavaScript runtime.

History and Origins

PureScript grew out of a specific frustration. By the early 2010s several projects were attempting to bring Haskell, or something like it, to the browser — among them Fay, Haste, and GHCJS. Each made compromises, whether in the size and readability of the generated code, the runtime model, or the closeness to JavaScript’s own semantics. Phil Freeman, unsatisfied with these approaches, decided instead to design a new language: one inspired by Haskell but defined from the start around clean compilation to JavaScript.

The result, released in 2013, was a compact language that deliberately diverged from Haskell where the web demanded it. The most consequential decision was to use strict (eager) evaluation rather than Haskell’s lazy evaluation, which keeps the generated JavaScript predictable and close to what a programmer would write by hand. Freeman’s 2014 book, PureScript by Example, gave the language an accessible on-ramp and helped seed a dedicated community.

Design Philosophy

PureScript is guided by a few clear principles:

  • Purely functional, no compromises. Like Haskell, PureScript is pure: side effects are represented explicitly in the type system rather than performed implicitly. This makes effects visible and controllable.
  • Strong static types, inferred. A rich Hindley-Milner-style type system with type classes catches large classes of errors at compile time, while type inference keeps most annotations optional.
  • Readable JavaScript output. The compiler aims to emit clean, comprehensible JavaScript rather than an opaque blob, easing debugging and interoperability.
  • Strict evaluation for the web. Choosing eager evaluation over laziness makes performance and resource usage easier to reason about in a browser environment.
  • A small core, a rich library ecosystem. The language itself stays lean; functionality lives in composable, independently versioned libraries.

Key Features

PureScript’s type system shares much with Haskell’s but charts its own course in important places:

  • Algebraic data types and pattern matching for modeling data precisely.
  • Type classes, higher-kinded types, functional dependencies, and higher-rank polymorphism.
  • Row polymorphism and extensible records, a distinctive feature that lets functions operate over records with “at least these fields,” giving flexible, type-safe record handling that Haskell historically lacked.
  • Strict evaluation by default (with some non-conforming alternative backends offering laziness).
  • A foreign function interface (FFI) for calling into existing JavaScript, making interoperation with the vast JS ecosystem practical.
  • Typed holes that support type-driven development: a programmer can leave a subexpression blank, and the compiler will report the type it expects there.

Notably, PureScript does not include some of Haskell’s most advanced features, such as generalized algebraic data types (GADTs) or type families — a deliberate scoping choice that keeps the language focused.

A small flavor of PureScript:

module Main where

import Prelude
import Effect (Effect)
import Effect.Console (log)

-- A simple algebraic data type
data Greeting = Hello String

greet :: Greeting -> String
greet (Hello name) = "Hello, " <> name <> "!"

main :: Effect Unit
main = log (greet (Hello "World"))

Evolution

PureScript has matured steadily through its 0.x series, with several releases standing out:

  • 0.12.0 (2018) reworked the type system and the core libraries.
  • 0.13.0 (2019) rewrote the parser and improved compiler stability.
  • 0.14.0 (2021) generalized the kind system with polymorphic kinds.
  • 0.15.0 (2022) moved code generation to ES modules, aligning PureScript with modern JavaScript bundlers and enabling effective tree-shaking.
  • The 0.15.x line has since continued with maintenance and tooling improvements, including statically linked compiler binaries in the 0.15.16 (2026) release.

The ecosystem evolved alongside the compiler. Early dependency management leaned on Bower; today the Spago build tool and package manager (paired with curated package sets) is the common workflow, the older Pulp tool having served an earlier generation of projects, while Pursuit hosts searchable package documentation. Even after more than a decade, PureScript remains a pre-1.0 project, reflecting both ongoing refinement and a deliberate willingness to keep improving the language.

Current Relevance

PureScript occupies a focused niche: it is the language of choice for developers who want Haskell-grade type safety on the front end. It is not a mainstream web language and does not compete with JavaScript or TypeScript on adoption numbers, but it sustains an active, devoted community and a healthy library ecosystem. Its flagship UI framework, Halogen, offers a fully type-safe component model, while bindings such as react-basic let teams integrate with React.

Industrially, the most prominent adopter is the payments company Juspay, which uses PureScript at significant scale for its user interfaces. Analytics company SlamData and web developer Lumi were influential early users and contributors. Together they demonstrate that PureScript is viable for production systems where correctness matters more than ubiquity.

Why It Matters

PureScript proves that a small team — initially one person — can design a principled, purely functional language and make it genuinely usable on the world’s most pervasive runtime. By keeping the things that make Haskell powerful (type classes, ADTs, purity) while shedding what doesn’t fit the web (laziness, an opaque runtime) and adding what the web needs (row polymorphism, clean JS output, a practical FFI), it stakes out a distinctive position in language design. For programmers exploring how far static types can go in eliminating front-end bugs, PureScript remains one of the most compelling and uncompromising answers available.

Timeline

2013
Phil Freeman begins designing PureScript, motivated by dissatisfaction with existing attempts to transpile Haskell to JavaScript such as Fay, Haste, and GHCJS. He sets out to build a small, strongly-typed functional language defined directly around clean JavaScript output.
2014
Freeman publishes the book "PureScript by Example," which becomes the canonical introduction to the language, and the project attracts a growing community of functional-programming enthusiasts on the web.
2018
Version 0.12.0 (May 2018) is released — a significant milestone that overhauls the type system and standard libraries, including improved kind signatures and a redesigned core library set.
2019
Version 0.13.0 introduces a rewritten parser and grammar refinements, improving compiler stability and error reporting.
2021
Version 0.14.0 lands, bringing polymorphic kinds (a generalization of the kind system) and further library modernization; ecosystem libraries such as the Halogen UI framework update to match.
2022
Version 0.15.0 (April 2022) switches code generation to ES modules, replacing the older CommonJS output and enabling modern bundling and tree-shaking with standard JavaScript toolchains.
2026
Version 0.15.16 (March 2026) continues the 0.15 series as a maintenance release, adding statically linked compiler binaries to ease installation across a wider range of Linux systems. PureScript remains a pre-1.0 project under active development.

Notable Uses & Legacy

Juspay

The Indian payments company Juspay is one of the largest industrial users of PureScript, using it to build payment and mobile-app user interfaces at scale, including its in-house PureScript-based UI framework.

SlamData

The analytics company SlamData was an early backer of PureScript, employing core contributors and sponsoring development of the Halogen UI framework, which it used to build its data-analysis front end.

Lumi

Lumi built production web applications in PureScript and open-sourced react-basic, a set of typed bindings that let PureScript code interoperate with React.

Halogen framework

Halogen is a declarative, type-safe UI library written in PureScript for building single-page applications, and is one of the ecosystem's flagship projects demonstrating the language in real front-end work.

Functional-programming teams and consultancies

PureScript is used by teams that want Haskell-style guarantees on the web, adopting it to reduce runtime errors in front-end code through its strong static type system and pure functional core.

Language Influence

Influenced By

Running Today

Run examples using the official Docker image:

docker pull
Last updated: