Purescript - Using psc-package instead of Bower

Posted on March 7, 2018

I have been using Bower to manage purescript dependencies. This relies on node and Bower to manage the packages. The problem is that there’s not a lot of users using Bower these days, meaning Bower is not well maintained anymore.

The purescript community has been trying to liberate purescript from node and bower. So they have made psc-package.

Download the source, extract, then build with stack build. After the compilation, run stack install. This will install the executable in the local bin-path. psc-package is now ready to be used.

To start a project run pulp build to scaffold the project. This will generate the Main directory with the Main.purs file and Test directory with the Test.purs file. This will also generate bower.json file. Delete this file since we will not be using bower anymore. Run psc-package init to generate psc-package.json.

Important sections to note about the psc-package.json file is the sets and depends field. sets is the set of packages, and the contents of the set is based on the version. So if the package we’re trying to install is missing check the version we may not have the right version. To check which package is included in the list go to package-sets. I believe package-sets are packages blessed by the community.

To install packages run psc-package install <package-name> or put the package name in the depends section of psc-package.json and run psc-package build.