What Is PureScript? What Is The Language Used For?

So, you heard about PureScript and are wondering what it is? Well, you’re in luck, because today I am going to explain exactly what PureScript is, why it was created, where it’s used, how to learn PureScript, and more!

Let’s get right to it.

// Hello World Program In PureScript

module Main where

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

main :: Effect Unit
main = do
  log "Hello PureScript!"

What Is PureScript?

In short, PureScript is a strongly-typed, purely-functional programming language that compiles to JavaScript. The language was created in 2013 and initially designed by Phil Freeman. It is most comparable to the famous functional language Haskell. You can check out the differences between the two languages here.

As you can see, PureScript is pretty… Haskell-y:

import Prelude (($), (*), (==), bind, pure)
import Data.Array ((..))
import Data.Tuple (Tuple(..))
import Control.Alternative (guard)

factors :: Int -> Array (Tuple Int Int)
factors n = do
  a <- 1 .. n
  b <- 1 .. a
  guard $ a * b == n
  pure $ Tuple a b

If you have never written in a functional programming language this code probably looks very foreign to you. Well, that’s because functional programming languages do things in a very different, and sometimes better way than traditional object oriented languages.

In fact, there is a pretty heated debate over what is better.

Why Was PureScript Created?

If you’ve followed my blog at all you may be aware that I am a big fan of functional programming languages. Functions as true first-class values, composability, immutability, expression based control flow just to name a few reasons why I wish functional programming was more common in the workplace.

Alas, although languages like JavaScript take a lot of inspiration from functional programming, it is not a pure functional programming language (uhh duh!).

That is where PureScript comes in. The language was an attempt to allow you to do anything JavaScript can do but in a functional programming paradigm. That means writing frontend software, backend software, and mobile and desktop apps all the functional way!

This means that with PureScript you have a:

  1. built in build tool
  2. no linting required
  3. removes the ‘==’ and ‘===’ issue
  4. removes the outdated ‘var’ keyword
  5. removes the confusing ‘this’ keyword
  6. updated futures and promises and removes callback hell
  7. fully functional
  8. built in validation
  9. built in types
  10. built in pure functions
  11. built in immutable data

Sounds pretty great right? Well, that’s what the creators of PureScript thought too, and thus, PureScript was born!

Who Uses PureScript?

So, who is actually using PureScript then? Well, it doesn’t seem like a lot of people are actually using PureScript in 2022. There was a recent survey sent out to the PureScript discourse forum and chatroom. A total of 660 people responded to the survey and of that total, 43.6% were non-PureScripters. A pretty high number for a PureScript message forum! Additionally only 26.42% currently used PureScript at the time of taking the survey. You can see the full survey here.

Is PureScript Used In Production?

As you can see from this number, the number of PureScript users in generally is pretty low. Meaning that the amount of production level code would be even lower. However, there are some companies writing production code with PureScript.

In the 2019 Typelevel Summit, Felix Mulder talks about his experience how the Scala team transitioned into writing production code using PureScript in AWS lambda, and services using Haskell. You can watch the video here.

So is production code being written in PureScript? Technically a little, but it’s extremely uncommon and unlikely to become a major trend anytime soon. I certainly wouldn’t recommend retiring your JavaScript skills just yet! Bad news for those of you that really hate JavaScript.

Where To Learn PureScript?

If you want to learn PureScript, a great place to start would be the docs. You could also utilize the discourse forums in order to ask questions and potentially find a mentor for your PureScript journey!

Additionally there is a great course on udemy that walks you through functional programming with JavaScript and includes lessons in PureScript, ClojureScript, Scala and Elm! A well worth investment to learn more about functional programming with JavaScript and boosting your overall coding skills.


So that’s pretty much everything you need to know! PureScript is a functional programming language that writes like Haskell and transpiles down into JavaScript. Allowing you to use functional programming wherever you can use JavaScript.

The language is still relatively new and lacks a large following. While the idea behind PureScript is pretty cool, it lacks the amount of production code you would need to see to really know how realistic PureScript is to use in your more serious programming projects. For now, you’re probably better off learning JavaScript or TypeScript.

As always, happy coding!

Grant Darling

Grant is a full-stack / frontend software developer passionate about writing & coding. He has many years experience working in the tech industry both as a freelancer and as an employee.

The Code Bytes is all about providing people with honest information about programming. To learn more about Grant, read his about page!

If you’re interested in freelance coding / writing services or want to partner with The Code Bytes, you can get in touch with me here!