What is PureScript?
PureScript is a purely functional programming language with no side-effects and static type-safety. In fact, it takes the “just pure code” philosophy to the extreme. It has one of the best type systems of most programming languages I have come across.
PureScript also offers lots of other high level features which make programming in the functional style easy and safe. For example, PureScript has no global state, has minimal mutable data and allows you to use recursion safely without the need to escape the recursion.
So why would you use PureScript?
PureScript is still a young language, but the type system is more advanced than most type systems available today. The type system also has a very flexible ability to do dependent types and polymorphism. This means that a very high level of type safety can be achieved in a type safe way.
Now we will have a closer look at how these two languages compare to each other.
- Elegant Haskell syntax: the code is beautiful.
- Type inference: there is no need to specify if variable is an integer, PureScript can understand it in most cases without explicit type keywords.
- Unpopular. PureScript is not used too much.
- The PureScript community is small.
- Can be hard for a newcomer.
- Extremely popular and widely used. There is a huge demand on JS programmers.
- Sometimes counterintuitive. So do not forget to read documentation.
- Hard to scale. To create a large project, you should use external libraries or frameworks.