In this post I'd like to highlight a few (programming related) things I worked on in 2021.
Blog
In 2021 I wrote 11 new blog posts (including this one)!
I'm especially happy with the Typing Giml series. I've been trying to learn how type inference algorithms work and how to implement them for a long time and found most papers and articles either a bit lacking some important details or too jargon-heavy for me.
In this series I tried to write the tutorial I wish I had, covering "the french approach" to type inference (constraint generation and solving in different phases), as well as more exotic features - extensible records and polymorphic variants.
I hope these articles will be useful to others who are trying to learn about type inference.
Streaming
In 2021 I started working on Strema, which was later renamed to Giml.
Giml is a purely functional programming language with emphasis on structural typing. Almost all of the work on the Strema/Giml compiler, which currently compiles Giml to JavaScript, was done while streaming on twitch.
This youtube playlist covers almost all of the sessions:
I started streaming in January and wanted to achieve 4 goals:
- Demonstrate and demystify the process of building a non-trivial Haskell program
- Demonstrate building a compiler in Haskell (to serve as a tutorial of sorts)
- Learn more about type inference, and prototype a language I wanted to build for a long time
- Have fun and communicate with others
I am quite happy with the result. I was able to stick with this project long enough to make a non-trivial compiler and share the process with others. I hope it helped a few people get into compilers or even just Haskell in general.
At some point Strema progressed enough that I felt I can switch the focus to Giml, the language I've been wanting to build for several years (and so I did).
For reasons beyond my control streaming halted in May and I haven't continued since. I hope to continue working on Giml while streaming in Q1 of 2022.
Open-Source Software
I've selected a few notable fun projects I worked on this year:
Bulletin-app
Late last year I published a scotty tutorial where we built a very basic bulletin board. After that, I decided to spend some time and expand the initial project to provide a more featureful example project - one with user authentication, cookies, a database, and more.
The result of this work and my first project of 2021 was bulletin-app. In this blog post I describe the various libraries used, how to run the program, and link to the following demo video:
Deep
I participated in Ludum Dare 48, a game jam where participants build games in 48 or 72 hours. This Ludum Dare's theme was "Deeper and deeper", and I built a "game" named Deep where the player needs to dig into the ground... and that's it. Due to time constraints and the fact that I wasn't very prepared for the jam the game isn't very interesting and frankly isn't much of the game.
During the game jam I tried to experiment with destructible terrains and multiplayer using alpaca-netcode. The game's codebase is heavily refactored but based on nyx-game.
You can see a demo of the multiplayer mode in this demo video:
If you are interested in trying the multiplayer mode, make sure you read the warning.
Giml
As I mentioned before, I spent most of the first half of 2021 working on Giml while streaming on twitch.
With Giml, I'd like to explore another point in the design space - a strict, purely functional programming language that provides extensible records, polymorphic variants and higher kinded types, but without type classes and many other advanced type-level features.
I hope to continue working on Giml in 2022 and add more features such as modules, operators, and lazy arguments, additional backends such as an interpreter, a WASM backend or a native backend, and maybe even development tools and a step debugger.
If you are interested in exploring the Giml codebase, you can find the repository on Gitlab, or you can explore the auto generated haddocks (which btw, I totally recommend creating as part of your CI step!).
Tapir
Tapir is a website generator I hacked in a couple of weekends in order to build Giml's website.
It mainly uses mustache templates, toml and markdown to create the website. The mustache templates are used to define page templates and look kinda like HTML with holes to plug in content, navigation, etc.
Each page contains two parts, a metadata header with information, such as the chosen template and page name, and the content of the page in markdown format.
Tapir will take this description of a website and will inject the markdown pages into their chosen templates and create HTML pages!
Tapir was pretty fun to build, and I'm quite satisfied with the result.
Book
Last but not least, I wrote a Haskell book!
Learn Haskell by building a blog generator is an introductory, project-oriented, free, and online book teaching Haskell while building a static blog generator.
With this book, I attempt to create introduction material for Haskell which focuses on software development in Haskell and "getting things done", rather than providing a comprehensive walkthrough to the language. I try to describe and demonstrate design patterns such as the combinator pattern and functional core / imperative shell, and cover topics such as error handling, writing tests, generating documentation, and more.
I tried to keep the book relatively short to try and reduce the amount of time and commitment a learner must invest in order to try learning Haskell, while still covering repeatedly asked questions and topics that I've seen beginners struggle with when they try to apply their Haskell knowledege to build useful programs.
I hope I've been able to achieve these goals in some way, and I really appreciate any constructive feedback I can get on the book. I would like to thank everyone who opened issues in the issue tracker, provided feedback, and submitted editing and typo fixes! Your help is greatly appreciated.
Final notes
These were the main things I worked on in 2021. I'm quite happy with what I got to create. If there's anything here that catches your eye, here's your opportunity to check it out!
If you found the things I work on interesting and you'd like to get more frequent updates from me, you might want to follow me on mastodon.
Thank you for reading. I wish you all the best in the coming year. May your 2022 be filled with happiness and peace.
Happy new year!