Posts

  • Type Level Merge Sort (Haskell)

    The recently presented Haskell library superrecord is still under heavy development and making great progress. While working on it we noticed that application code using the library would become very slow to compile when the record size exceeded 10 fields. Without any deeper thought, I guessed that the current type level insertion sort (which is O(n^2) in worse case complexity) was at fault. This turned out to be wrong, but I still implemented a more efficient merge sort at type level and would like to share the journey as it was quite fun.

  • SuperRecord: Anonymous Records for Haskell

    Many mainstream Haskell programs that reach a certain size need to solve at least two core problems. First, all your logic will run in some kind of environment that provides logging, configuration, other external data such as templates and/or some global application state. This environment must be managed somehow and correctly be passed to the specific logic. Secondly, you will need to read and write out data into the real world, for example, to talk to a JSON REST-API. Let’s take a look in detail at these problems and how we can solve them today.

  • DIY: Haskell docs

    Recently, I wanted to make sure that the generated API documentation for my web framework Spock is always available (on the web) and up to date, both with the current release and with the current master branch.

  • Interview Question: Wine Bottles

    A popular puzzle interview question goes like this: “Sir Blake has 200 bottles of wine in his wine cellar. 99% of those bottles are red wine and 1% of them are white wine. How many bottles of red and/or white wine does Sir Blake need to drink to reduce the percentage of red wine to 98%?”

  • Parser Combinators

    Today we will explore how to build a small parser combinator library in Haskell from scratch. This blog post is the result of an experiment to see if I could actually implement this by only looking at the base and text documentation, explicitly without looking at other parser implementations or examples.

  • Optimistic UI and Reactive Programming with Elm

    I’m still on the hunt for “the right” programming language for web front-ends. JavaScript is fun and very good for quickly hacking together something, but as soon as your project grows you either need a large number of tests and discipline or your going to break something with every refactoring. TypeScript seemed like a good rescue - but coming from Haskell I have high standards for type systems and the TypeScript one still has loop holes. The other problem with both languages is, that you are responsible for managing and syncing your state and model correctly. React and other frameworks help you with this, but you still have to use them correctly and there’s always a way to sneak around. Elm to the rescue? Let’s see!

  • TypeScript and 'this' in class methods

    At Checkpad we are moving JavaScript code to TypeScript. Apart from some initial “take-off” issues like finding, modifying and/or writing missing .d.ts files for libraries, or getting our build pipeline to work, the process was pretty smooth. A few months into that, I’ve discovered some road bumps and will share one today.

subscribe via RSS