Blog

  • OCAML 5 is Out + Effects Tutorial

    OCAML 5 was released, and one of the features many on Twitter were happy about was effect handlers. I don’t have much experience in Haskell, but one of the cool features it offers is you choose if something is an Error/Exception and the program should stop, or you should keep going.

    Typically, if it’s your code, that’s no problem. However, if it’s in a 3rd party library, or a module you didn’t write, you have no choice to just “handle the error”. Unclear how this doesn’t leak implementation details, but I’m super n00b at Effect handlers (a la Unison). Really cool to see it be used as a primitive to create async/await, streams, and Go-lang-like imperative style shared concurrency with all the type guarantee’s OCAML gives you. I wonder when ReScript will enhance async/await to handle Effects (or maybe you already can).

    Effects Tutorial: https://github.com/ocamllabs/ocaml-effects-tutorial

    OCAML 5 Announcement: https://discuss.ocaml.org/t/ocaml-5-0-0-is-out/10974

  • TypeScript Enum’s vs Discriminated Unions

    In this article I wanted to compare and contrast Enum‘s and Discriminated Unions in TypeScript and compare them to each other. In my Object Oriented Programming days, we’d occasionally to never use Enums, whether they were native to the language or emulated. Nowadays, in my Functional Programming groove, I use Discriminated Unions all the time, whether native to the language or emulated. TypeScript is interesting in that it supports both natively.

    Update: I have a video version of this article.

    (more…)
  • Roc Lang for Advent of Code 2022

    This year I choose to do Advent of Code using Roc Lang. I wanted to talk about my experiences as it was pretty fun and I learned a lot.

    (more…)
  • Getting Tailwind to Work with Elm Book

    Trying to help build a design system at work in my spare time; no clue if it will go anywhere but it’s fun regardless. I asked the Elm Slack group what the equivalent of React Storybook is in Elm land. Specifically, I wanted a way to build a documentation website like Vuepress with the ability to host native Elm code to showcase components. They pointed me to Elm Book. While Elm Book has built-in theming capabilities, I needed CSS control over my components. While they support elm-css, I wanted the ability to use TailwindCSS. The Elm libraries haven’t kept up with Tailwind’s changes, which is fine; writing raw Tailwind CSS on Elm HTML functions is easy and co-located with the component you’re styling.

    However, getting it to work in elm-live, which elm-book wraps, was a bit challenging. I wanted to layout how to get this to work in case you’d like to use Tailwind or your own CSS framework.

    (more…)