Welcome! We notice you're using an outdated browser, which will result in a degraded experience on this site. Please consider a modern, fully supported browser.

webbureaucrat

from legacy to functional and very little in between.

Archive

  1. Binding to a JavaScript Function that Returns a Variant in ReScript

    ReScript provides easy ways to bind to most JavaScript functions in a way that feels both native and safe. Conveniently, it even provides an @unwrap decorator for parametric polymorphism. However, there are a few places where we still have to fill in the gaps. This article documents how to bind to a JavaScript function that can return any one of several different types using ReScript variants.

  2. Styling for Internet Explorer Using Progressive Enhancement

    Internet Explorer 11 accounts for less than one percent of total Internet usage globally and less than half a percent in the United States. Even Microsoft's own web apps have stopped supporting it. But on the off chance someone does use Internet Explorer, what do you want them to see? This article explains how to employ the concept of progressive enhancement to provide a moderately acceptable experience to users of a decaying platform without taking on all of the legacy burden of formally targeting it.

  3. Writing Service Workers in ReScript

    Does your SPA work fully offline? Would you like to define a caching strategy in an exhaustively type-safe way? If so, you might be interested in this Service Worker binding for ReScript (formerly BuckleScript / ReasonML). This article documents the binding by example, including two different caching strategies and a service worker registration example.

  4. Setting Up Webpack for ReScript

    As much as I strongly prefer ES6 modules, using them with ReScript (formerly BuckleScript / ReasonML) and ServiceWorkers just isn't practical right now. I'm writing this article so that I can easily grab the configuration the next time I need it. This is a beginner's guide because I am a webpack beginner, and, well, everyone is a ReScript beginner right now.

  5. Displaying Notifications in ReScript

    This article will serve to document and demonstrate the rescript-notifications npm package, a complete set of bindings for the JavaScript-compiling ReScript language (formerly BuckleScript/ReasonML). At the close of this article, the reader should be able to enable and display notifications in an entirely type safe and functional way.

  6. Writing Elm Ports in ReScript

    This is a post-rebrand update to my previous post, "How to Write Elm Ports in ReasonML." I rewrote the package in the new ReScript syntax so that people who aren't familiar with the old syntax can still read it. Recently I've published an npm package called res-elm and put it into production on a couple of projects. It's documented briefly by its README, but I think it deserves a full post. This post will walk through how to set up ports both into and out of an elm 0.19 project using ReScript.

  7. Tracking COVID-19 Vaccinations in Chicago: Release Notes

    Happy New Year, and thank you for reading! I am delighted to announce that the City of Chicago has started reporting daily statistics on COVID-19 vaccinations, and so am I. This article will detail recent changes as well as changes to come in the near future.

  8. Designers and front-end folks! How do you name colors?

    In my back-end life, naming values that get reused is important to maintaining clean code, but somehow I keep turning my CSS variables into spaghetti. I've tried three basic strategies, none of which seem to work quite right for me.

  9. Continuously Deploying an NPM Package with GitLab CI/CD

    Setting up continuous deployment is important to me, even when publishing is as simple as it is on npm. The official GitLab documentation, though, is a little more than I need and geared toward their own npm repository, so I'd like to gather the information I need here in a brief article.

  10. Parsing JSON in ReScript Part III: Getting to the Point

    After having established some requirements and some basic utilities, we're ready for the fun part: putting the pieces together. At the end of this post, we will have our working parser.

  11. Parsing JSON in ReScript Part II: Building Blocks

    This is the second in a series of articles on how to build one's own, general-purpose parsing library. After having established a few expectations in the previous post, we are ready to begin building our utilities for our library. Let's start with some highly generalized utilities for functional programming.

  12. Parsing JSON in ReScript Part I: Prerequisites and Requirements

    There are few things more satisfying than a slick, readable, and safe JSON parser. It's one of the joys of functional programming. Using a good JSON parsing pipeline can feel like magic. This series seeks to lift the veil and empower readers (and, importantly, my future self) to build their own customizable and extensible parsing libraries. This article, the first of several, will be a skimmable introduction to the subject as I see it.

  13. How to Upgrade from BuckleScript to ReScript

    I have a weakness: I have never seen an update I didn't want to adopt immediately. Betas? No thanks. Give me the nightly build. New major version of the Linux kernel? I'll just run the installation without stopping to grab my charger. So when BuckleScript announced a whole new language syntax (along with a rebrand to "ReScript"), I got excited and immediately wanted to transpile everything. This post will document the simple process step-by-step.

  14. Tracking COVID-19 in Chicago: Release Notes

    Chicago Test Out is a project that use the same datasets as the city data Daily Dashboard but features more detailed line charts, mobile compatibility, and much faster load times. This week, the project is undergoing several major changes, and I want to take the opportunity to explain these changes for users.

  15. Safer Data Parsing with Try Monads

    I have written previously on maybe monads and how to use them with lists to eliminate the possibility of null references in an object-oriented programming language. This standalone post walks through how to use a more generalized kind of monad to prevent all other kinds of unhandled exceptions, using data parsing exceptions as an example.

  16. Error-Free C# Part II: Functional Data Processing

    Mutability bugs and thread-unsafety are big problems in data processing. Fortunately, the .NET Framework has strong support for immutable collections, eliminating entire categories of bugs. This post will show how to use extension methods to create even safer ways to interact with with lists in C# by building on the IMaybe monad type we created in the previous post in this series.

  17. Error-Free C# Part I: The Maybe Monad

    Most people would probably be surprised to find that I consider myself both a professional C# developer and a professional functional programmer. C# is mainly an object-oriented language. The syntax isn't optimized for functional programming. This is entirely true, but just because Microsoft is behind the curve in supporting the new best practices in programming doesn't mean I have to be. This series will walk through how to build and use C# code that is guaranteed to run without any runtime errors.

  18. ReScript: The Module or File Can't Be Found, Unabridged

    If you work with BuckleScript, now ReScript, you'll likely come across the common build error message, "The module or file $name can't be found" followed by a few helpful suggestions for how to properly install a ReScript module. It's a good error message, but I've found it underestimates me in my ability to get things wrong, especially if I'm the one who wrote the missing module to begin with. I'm going to write a guide while one of these problems is still fresh in my mind so that I have a checklist to go through the next time I get frustrated.

  19. How to Write Elm Ports in ReasonML

    Recently I've published an npm package called bs-elm-es6 and put it into production on a couple of projects. It's documented briefly by its README, but I think it deserves a full post. This post will walk through how to set up ports both into and out of an elm 0.19 project using BuckleScript 7. (If you're curious, I'm deferring decisions about the rebrand/new syntax until we get the new npm package.)

  20. How to Use Excerpts in Eleventy

    Recently, I added first-paragraph post excerpts to this Eleventy blog's homepage post list. I found it wasn't easy. It wasn't all documented all in one place. Further, in order to use Markdown excerpts in HTML, I had to write a simple custom filter. I'd like to document the process here from end to end.

  21. Issues and Contribution

    I've pushed out a few packages recently, and I'd like to take the opportunity to publish a catch-all document on contribution and issues for each of these. This post will walk the user through my current thinking on how to engage these projects, and I'll keep it up to date as my thinking evolves.

  22. Elm Line Charts Part III: Lines and the Chart

    This is the last installment of a series describing how to configure an Elm LineChart. In the previous post I used a viewmodel to configure an axis, so this post will cover how to use lists of those viewmodels to plot the rest of the chart.

  23. Elm Line Charts Part II: Imports and Axes

    This is the second in a series of blog posts dealing with LineChart in Elm. In the previous post, I outlined how to grab the timezone as a prerequisite for time-based linecharts. In this post, I will begin to write the chart module I'm trying to use in Chicago Test Out by defining my imports and creating a custom axis.

  24. Elm Line Charts Part I: Times and Timezones

    Elm has a very fine third-party line chart library which I've enjoyed using in my passion project, Chicago Test Out. It's well-documented as a library, but if I haven't used it in a while, I find myself struggling to get started with it. I end up starting at the middle or near the end and then clumsily working backwards from where I want to end up. For this reason, I'm working on writing a step-by-step guide for working with terezka/line-charts based on my own preferences and assuming a high-degree of customization apart from the defaults, using Chicago Test Out as a model.

  25. Dynamic Options and Optional Parameters in ReasonML

    The next type I want to bind from the JavaScript ServiceWorker API is Cache. At first glance, Cache doesn't have any dependencies on any JavaScript interfaces we don't already have access to, but its methods do use dynamic JavaScript options parameters, and the way we deal with this in typed languages is to name and create new specialized types. In this post, I will implement types for these options and the functions that use them.

  26. Binding FetchEvent Using Properties and Constructors

    Having successfully bound ExtendableEvent, I can now work on inheriting this interface for FetchEvent. Along the way, I'll install bs-fetch as a BuckleScript dependency and bind to JavaScript properties.

  27. ReasonML Journey Part IV: Publishing BuckleScript Packages on NPM

    In the previous post, we finished wrapping ExtendableEvent in ReasonML. In this post I will publish our type on npm.

  28. ReasonML Journey Part III: Generics, Promises, and ExtendableEvent.waitUntil()

    This post continues the quest of trying to recreate the JavaScript service worker class ExtendableEvent in ReasonML. In this post I will show how to extend the subtype of event to include ExtendableEvent's waitUntil method, which takes a generic Promise as a parameter.

  29. ReasonML Journey Part II: Subtyping and ExtendableEvent

    The first stop on my quest to wrap a JavaScript library in ReasonML is a small, simple JavaScript interface ExtendableEvent, a class with no properties and only one method on top of what it inherits from Event. In this brief blog post I will set out a simple template for subtyping in ReasonML.

  30. ReasonML Journey Part I: Getting Started with BuckleScript

    ReasonML is, at the time of this post, a very young language and, as such, very much underdocumented. It's also missing a lot of the JavaScript standard libraries. I see both of these things as an opportunity to contribute both to the foundational documentation and to the libraries that haven't been written yet. This blog series will serve mainly as a resource to me as an absolute beginner trying to retrace my steps, but I hope that someone else may someday find it useful as well.