guides/Style-Guide.md
This page contains guidelines for writing PureScript libraries. You might consider this a set of best practices, or if you would like to contribute to the core libraries, a set of guidelines for getting your pull requests accepted.
The PureScript core libraries are good examples of how to put these guidelines into practice.
README file.It was previously common to include Markdown documentation generated by psc-docs in the repository. However, now that we have Pursuit, there is no need to do this. The recommended approach is to link to your documentation on Pursuit from your README, and to avoid checking in Markdown documentation generated by psc-docs.
README file.README)Set up continuous integration for your project to verify that your library compiles correctly.
Travis can be set up easily. Here is a template .travis.yml file:
language: node_js
dist: trusty
sudo: required
node_js: 6
install:
- npm install purescript spago -g
script:
- spago build && spago test
Display the Travis badge in your README file so that the build status is visible.
purescript- so others can find your work.
bower version 0.0.0 and push tags for your initial release (this prevents interim work not intended for publication from leaking on 0.0.0 libs).bower link (learn all about it here). This will enable you to keep the repos in sync as you work, and facilitate publishing when ready.bower link can also be useful if you plan on contributing to a package needed by your project. Simply fork the repo, and link. Once you have your additional bindings, or features needed for your project working, you can contribute them back to the source repo easily with a Pull Request.Pursuit version badge in your README file, with a link to your documentation on Pursuit.newtype to convey additional information about primitive types where applicable (for example, consider using newtype EmailAddress instead of just String).forall props. { | props } (for "arbitrary records") and forall a. a -> ... (to avoid specifying exact types). PureScript has a rich set of types such as Foreign and FnX for safe interop with JavaScript, so this is never necessary. Create a new foreign data type if need be.Data for data structures and their functionsControl for control structuresNode for NodeJS-related functionalityREADME file.bower.json file and alerts you if your dependencies go out of date. If you have Travis up and running for CI, you can then easily test to see if those changes are breaking changes, and address them more promptly.README file.