Long articles

My long articles, which you perhaps even might want to print.

In this category

Posts in this category, from newest to oldest:
  • Algebraic Data Types In Scala
    Published Feb 24, 2018. Last revised Mar 20, 2018. In categories: article, types-in-scala, scala

    Scala offers different programming paradigms, from object oriented programming (OOP) all the way to functional programming (FP). Most Scala developers come from OOP and know OOP classes and inheritance well, but lack familiarity with algebraic data types commonly used in functional programming. In this article we aim to explain algebraic data types and their use in Scala.

    We start with a simple formal notion of a type and combine simple types with sum and product types to introduce algebraic data types. We then show how Scala encodes these types, with some comparison to Haskell to illustrate the boilerplate Scala imposes for these types. Noticing similarities between certain combined types we now take a look at generics and isomorphisms between types. We conclude with some remarks about the effects of subtyping which comes with sum types in Scala, and outline how subtyping impacts the ergonomics of sum types in Scala.

    Read more…

  • Maven Central Releases with SBT
    Published Jul 3, 2017. Last revised Jan 21, 2018. In categories: article, scala

    Coming from Haskell and Python I found releasing a Scala library a cumbersome process. The standard Maven Central archive—JCenter claims to be a more popular alternative, but all big projects appear to prefer the former—lacks a convenient web interface like that of Python’s package index or Haskell’s Hackage, and comprehensive documentation about publishing. Getting an artifact to Maven Central for the first time involves a surprising number of manual steps and a rather elaborate SBT configuration.

    In this article I hope to connect all the loose ends and offer a comprehensive step-by-step guide from nothing to a Maven Central release. I will start with some prerequisites which lie outside the scope of this article, guide you through the necessary bureaucracy and cover the setup. At the end I’ll introduce sbt-release, a powerful plugin to automate the entire release.

    Read more…

  • Read and write files in Emacs Lisp
    Published Nov 15, 2016. Last revised Jan 21, 2018. In categories: article, emacs

    A lot of Emacs Lisp code uses interactive commands like find-file or write-file to read or write files. This article gives reasons not to follow this pattern, and shows safer alternatives with the f.el library and with built-in functions.

    Read more…

  • Reproduce bugs in emacs -Q
    Published Nov 29, 2015. In categories: article, emacs

    When reporting issues to Emacs packages you will often find maintainers replying with “Please reproduce this issue in emacs -Q”. This article explains what this means, why maintainer may ask for this and how to use emacs -Q to reproduce an issue.

    Read more…

  • Emacs script pitfalls
    Published Aug 12, 2014. Last revised Oct 3, 2016. In categories: article, emacs

    Emacs offers some flags to use Emacs Lisp for standalone scripts, however Emacs’ decade-long history as an interactive program makes writing standalone scripts an intricate and subtle experience. This article starts with a discussion of the safe and correct Emacs Lisp shebang—which turns out to be much longer than you might expect. We then take a look at command line arguments and standard input and output of Emacs Lisp scripts, and finally conclude with some debugging tips and the recommendation to better use another language for your scripts.

    Read more…

  • Autoloads in Emacs Lisp
    Published Jul 2, 2014. Last revised Aug 5, 2016. In categories: article, emacs

    Emacs offers an autoloading mechanism to load libraries on demand when calling functions. This article explains how to declare autoloads, how they work, and how Emacs Lisp packages use autoloads to improve startup time.

    Read more…

  • Advanced syntactic fontification
    Published Jun 16, 2014. In categories: article, emacs, emacs-font-locking

    This article concludes my series about Font Locking in Emacs by illustrating how to hook into Emacs’ syntactic analyses to implement context-sensitive fontification. If you are new to this series, you may want to read the earlier articles on Syntactic Fontification in Emacs and Search-based fontification with keywords.

    Read more…

  • Calling Python from Haskell
    Published Apr 15, 2014. Last revised Apr 16, 2014. In categories: article, haskell

    Use Haskell’s FFI interface to run Python code for fun and profit.

    Read more…