Fullstack with two purely Functional Programming Language

The need arose when I was writing a full stack web application with PureScript being the frontend and Haskell being the backend. While these two languages are largely similar, the fact that they are different implies that one cannot share the codes directly between them. For all data types defined in Haskell, I have to rewrite them in PureScript. This seemes to be an automatable process so I decided to find a way to let the computer do the work for me! Let’s start with my preferred way of structuring data types in both languages.

PureScript Dealing with data types…

In Functional Programming , we have three terminologies , term , type and kind. Understanding their definitions are crucial to understand functional programming as a practioner.

List of purely functional programming languages (Image taken from https://www.fpcomplete.com/)

Terms are runtime values , some examples are 1 , True and "Hello" .
Type is the type of a term, the type of 1 is Int, the type of True is Boolean, the type of "Hello" is String and so on.
Kind is the type of type. For example, the kind of type Int is Type .
Term has type while type has kind.

Let’s start with the simplest data type which is…

Ong Yi Ren

FP Enthuasist. Live in Singapore. Works as DevOps Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store