TypeScript and Generators

Starting in TypeScript 3.6, tsc’s previously “whatever brah” mentality surrounding generators was finally replaced with accurate types. This is nice, because it gets us some extra guarantees at compile time, in particular when dealing with some asynchronous code. But the types of generators can be tricky to grok at first, and in order to understand […]

Implementing Boolean algebra in Sanctuary with nullary types

In a couple of previous posts, I’ve used “nullary types”, and sort of hand-waved away any explanation of what that actually means. When we’re dealing with types, some are simply a set of concrete values. Consider the classical Int, Bool, or Char; you have all the information you need to use those types just based […]

Defining Custom Types in Sanctuary

Sanctuary is a functional programming library for JavaScript that provides typechecking and compatibility with the Fantasy Land spec. If all that is a bit unfamiliar to you, never fear! Sanctuary’s docs provide a less esoteric way of describing the library: Sanctuary promotes programs composed of simple, pure functions. Such programs are easier to comprehend, test, […]