ReasonML has stolen my attention recently.
If I’m not at work or running about, I am probably digging into some ReasonML/OCaml repositories like an addict in the tenderloin.
Perhaps I like it for the unparalleled incremental build speed.
Perhaps I like it because of my affinity for math in school, and the functional paradigm gives me a warm fuzzy feeling inside.
There are a few reasons, no pun intended, for my love of Reason.
~end wizard speak~
For starters, Reason is basically a syntax upgrade to OCaml. Let me start by describing how that helps us.
OCaml is a pretty damn fast language. It’s incremental build times dwarf that of almost any other language.
Its type system is nearly impenetrable, and the compiler does a solid job of make you exhaust all of your options in branching logic.
It’s powerful type inference cleans up a lot of the verbosity associated with annotating functions and variables with types.
OCaml is a proven language of academics and industries where safety and mission critical code is paramount. This was one of the reason’s it was adopted as the base for ReasonML.
Reason syntax is far easier to read and digest than that of OCaml, and most other functional languages for that matter.
Its massively more accessible to newcomers than OCaml in that you probably wont spend days trying to install your dependencies properly. When using BuckleScript its often just another npm install <package>.
npm install <package>
Over the past few weeks, I’ve been exploring writing Native Reason code. I think some of the projects that are being developed show great courage in showing off the potential of ReasonML.
I want to communicate with databases, make blazing quick command line tools, and write super efficient servers, perhaps serving GraphQL.
And I want to do it with the same language that I’m writing in for my web applications.
By further leveraging the OCaml ecosystem we can actually write incredibly robust servers and developer tools.
The Esy package manager allows us to install and build packages from npm or opam in a convenient package.json fashion without having to manually hack system dependencies.
As Esy further develops, Reason on the backend will become increasingly more accessible to developers looking to write stupidly fast native code.
If you’re interested in what’s already been made with Esy, check out the following projects:
And there are more out there in the Forests of Open Source.
This certainly won’t be my last post on this topic so stay tuned for more Reason evangelism on the horizon.