(Original published September 30, 2021. Updated May 7, 2022)
Introduction Most of my Rescript series so far has been about combining Rescript with React using create-react-app. Now that I understand Rescript better, I’m not so sure create-react-app is a good fit for it.
Mostly because it’s slow. Rescript compiles JSX natively, so we shouldn’t need slow and hard-to-configure webpack. Most of create-react-app is about hiding the configuration of webpack from the end-user.
Introduction I’ve been writing plenty about Rescript this year, although I’ve taken a bit of a hiatus to focus on developing a couple (Rescript) open source libraries. I wanted to get back into blogging to answer one of the most confusing questions in the Rescript community: What is ReasonML and how does it relate to Rescript?
However, it has grown into something quite a bit bigger. Instead, we’ll be talking about the relationships between a collection of several interrelated languages, and I’ll give my opinion on which you should use.
As hinted in some of my recent articles on Rescript, I’ve been working on bindings to the wonderful Dexie interface to IndexedDB. It’s finally ready to announce to the world (in a fairly beta format)!
rescript-dexie depends on a recent version of Rescript and the rescript-promise library.
It’s still fairly beta and I haven’t covered all the features Dexie packs in yet, but the basics are working well. It feels intuitive and gives the right mix of sound type safety and easy call sites.
Introduction (Note: There is a more recent version of this article)
Most of my Rescript series so far has been about combining Rescript with React using create-react-app. Now that I understand Rescript better, I’m not so sure create-react-app is a good fit for it.
Mostly because it’s slow. Rescript compiles JSX natively, so we shouldn’t need slow and hard-to-configure webpack. Most of create-react-app is about hiding the configuration of webpack from the end-user.
Introduction For basic syntax, functional programming does not feel that different from other paradigms. Sure, data and behaviour are separate, so you don’t have classes or objects or inheritance, but it feels relatively the same. This is especially true in Rescript, with the pipe-first syntax almost looking like a method lookup (comparable to the self object in Python).
But if you go deeply into a study of functional languages, you start encountering bizarre words such as “monad” and “functor”.
Introduction Polymorphic variants in Rescript are strange beasts. They aren’t generally that useful in pure Rescript programming, but are frequently necessary in binding to Javascript.
Polymorphic variants are extremely flexible (too flexible), but one of the most common uses is to represent a list of constant strings that a JS binding can accept. For example, the ubiquitous on function used for event handlers typically takes a string as its first parameter, as in on("click".
Parsing dynamic content such as JSON in a statically typed language can be rather daunting. This article voices some opinions about schemaless design and migrates some of the messy json parsing code from the standard library to the excellent jzon library.