PureScript v0.15.0 Released

I’m excited and proud to announce the release of PureScript 0.15!


npm i -g purescript

If you are new to PureScript, you can follow the getting started guide to give it a try.

About this release

PureScript 0.15.0's main feature is the support for ES modules. But that’s really a summary for the following changes:

  • modernizes the FFI to use ES modules and dropping support for CommonJS modules

  • drops purs bundle and defers to external tools like esbuild, which produces a bundle size ~25% smaller than purs bundle.

  • enables unbundled development and integration with new tooling like Snowpack

This release also fixes the two major reasons why npm install purescript would sometimes fail: libtinfo and glibc. Say hello to a better newcomer experience.

Type-level programming fans will also enjoy the support for type-level integers. Be creative and let us know how to further build upon this feature.

As for the rest of the new features and other improvements, you can read about them in the compiler release notes:

Due to the FFI migration and other breaking changes, most code that compiles with PureScript 0.14 does not compile on PureScript 0.15. Fortunately, the 0.15 migration guide refers to a script that can automatically migrate most CommonJS code to ES Modules. It also lists what changes one needs to make to get the code to compile again:

PureScript’s core infrastructure is compatible with PureScript 0.15. But a few resources won’t transition for a little while longer. These include:

If you would like to help out with updating these resources, please let us know.

Upgrading your dependencies

The core libraries have all moved to new major versions to support the new compiler. This means that most libraries in the ecosystem will also need to update to new major versions.

If you are a Spago user, then you will automatically opt-in to the latest 0.15-compatible package set if you run spago init or spago upgrade-set and have the 0.15.0 compiler in your PATH. If you are a Bower user, then you can update your dependencies to their new major versions the usual way. (Use this jq script to update core, contrib, node, and web dependencies).

The initial PureScript 0.15 package set contains all libraries from the purescript, purescript-contrib, purescript-node, and purescript-web organizations. It also includes any libraries from the latest 0.14.7 package set that still compile. This is a small package set, but it will grow rapidly in the coming weeks.

Adding your library to the package set

Many libraries have been dropped from the package set because they did not compile with the new compiler and core libraries. The vast majority of libraries that were dropped only need simple, largely mechanical updates to be compatible again.

If your library is one of them, please refer to the migration guide and the changelogs of your dependencies for help updating. Once your library is updated, you will need to make a pull request to the package sets repository.

We have commented out libraries from the 0.14.7 package set that were dropped from the 0.15.0 package set. This should help you make updates – simply uncomment your library, update the version number and/or dependencies, and submit a pull request.

If your library wasn’t dropped, you may still want to update it to take advantage of some of the new features.

Finally, consider cleaning up some of the warnings the compiler emits via purescript-psa:


npm i -g purescript-psa

# if using spago

spago build --purs-args "--censor-lib --strict"

# if using pulp

pulp build -- --censor-lib --strict

Acknowledgements and Gratitude

Special thanks goes to all those who helped out with the ES modules compiler support, library migration, and documentation updates:

And shout-out to @PureFunctor, a newer contributor to the PureScript compiler, who’s been doing some great work!

Lastly, thank you @sid-yip for fixing the glibc issue. That has been a hindrance for quite some time.

Next steps

You can begin using PureScript 0.15 today. Please enjoy the new release!

42 Likes

Great work! Everyone that helped make this new version a reality, I want to say thank you for all your hard work!

I’d like to help update the book to v0.15 if you need help with that :slight_smile:

5 Likes

I’d like to help update the book to v0.15 if you need help with that :slight_smile:

Help would be appreciated! If you want to open up a PR, we can get that started.

Also, do you have any interest in maintaining that documentation work? Or just in getting it updated to 0.15.0?

1 Like

I could be up for more. Let’s start small and see how it works out :slight_smile:

1 Like

Are there any benchmarks for a performance of the code? The articles mention a much smaller bundle sizes which result from cleaner generated code, so I’m curious how does that affect time performance.

Edit: Anyway, I’m on vacation now, but in a week I’m back and I’ll try to upgrade our production to v0.15. I’ll make some benchmarks on my own and let you know what I noticed.

1 Like

I’ve seen some benchmark/performance-tests (halogen-hooks) and from there I’ve got more FPS but cache-size, etc. all was very similar.

Real World Halogen is now on Halogen 7 and PureScript 0.15 — this has got to be the most painless compiler / Halogen upgrade ever!

The update also brought the bundle size down about 100kb, and it’s nice to be able to drop the zephyr dependency and simplify the bundling process.

4 Likes

While not the same as the Book, my learning reference has been updated to 0.15.0. ps-0.15.x-v0.31.0

Changes from the last release are here:

4 Likes

So in my case, after upgrade from purs-v0.14.5 + webpack to purs-v0.15 + esbuild the js+css package size decreased from about 2MB to 1.6MB. Build time decreased from ~1.5 mins to 10-20 secs, rebuild times (--watch) also decreased significantly. I have also noticed a slight overall performance gain, but nothing quantifiable.

Overall, thank you very much for the update :slight_smile:

3 Likes

sweet! have you tried purs-v0.15 + webpack?

Yes, I tried at first with some webpack plugin for ecmascript, and it worked, but my goal was switching to esbuild for speed entirely so I didn’t care much about it.

Once https://github.com/purescript/purescript/pull/3915 lands, I imagine this will only get better.

1 Like

Is there any quickfix for packages.dhall to make the PureScript by Example book repo at least runnable with 0.15.0 ?

Error message for spago test in chapter 2:

[error] Oh noes! It looks like the PureScript version installed on your system is not compatible with the package-set you’re using.

installed purs version: 0.15.0
minimum package-set version: 0.14.0

There are a few ways to solve this:

  • install a compatible purs version (i.e. in the same ‘semver range’ as the one in the package set)

  • if the purs version is ‘too new’, you can try using spago upgrade-set to upgrade to the latest package set

  • if you know what you’re doing and you want to disable this check, you can override the version of the metadata package in the packages.dhall, e.g.:

    let upstream =
    in upstream
    with metadata.version = “v0.15.0”

I tried adding

>   in  upstream
>     with metadata.version = "v0.15.0"

below let upstream = , doesn’t seem to work as described or I got the error wrong.

You’ll either have to use 0.14 with it (you can install it locally with npm for example) or you’ll have to spago upgrade-set and then deal with the errors you get (mostly moving common-js to ESM and for the book some changes because math got deprecated)

There was a similar question asked a while ago where I posted some details on option 2 (but the OP decided to go with option 1)

1 Like

If I downgrade to 0.14, does spago need to be downgraded as well - or can it run with every purs compiler ?

you dont need to downgrade spago

1 Like

Can this conversation (if it’s not done) be moved to its own thread? It’ll get better visibility that way if others encounter the same issue and are wondering how to fix it.

1 Like