Higher Kinded Types in Purescript

We’ve seen how we can create simple types in Purescript. Purescripts allows us to take these types even further. We can have types that can take parameters that allow us to create new types. For example, in the previous post we had the Planet type : data Planet = Mars | Neptune | Uranus Supposing we then had the requirement to represent no planet at all. After all, some aliens just roam around the Galaxy without coming from any particular planet. »

Types in Purescript

First and foremost Purescript is a very strongly typed language. All functions must have their types defined. This is a typical example of a function definition : length :: Array -> Int The length function above has to take an Array, and it is guaranteed to return an Int. There is no situation where anything else will happen - guaranteed! Purescript has a compile stage where it will take all the Purescript code and convert it into Javascript. »