• Motivating the Foldable Type Class September 16, 2016

Something I have never seen articulated is why the Foldable type class exists. It is lawless apart from the free theorems which leads to ad-hoc definitions of its methods. What use is the abstraction if not to enable us to reason more easily about our programs? This post aims to articulate some justification stemming from the universality of folds.

In brief, here is the argument.

1. For inductive data types, the fold is unique defined as a consequence of initiality.
2. The Foldable type class is a way to exploit this universality without having to define all of our data types as the fixed points of base functors.
3. The uneasiness comes from this impedence mismatch between points 1 and 2.

• Why do pattern synonyms not cause type refinement? June 18, 2016

Pattern synonyms can’t (safely) cause any additional type refinement than their definition dictates. This means that they can’t be used to provide a GADT-like interface when the underlying representation is not a GADT. The purpose of this note is to explain this restriction.

• Pattern Synonyms in GHC 8.0 December 12, 2015

There have been four small but significant improvements to pattern synonyms which are going to appear in GHC 8.0.

This work closes up some holes which were left in the implementation of pattern synonyms and should provide library authors with a new and flexible method of abstraction.

• Automatically Apply HLint Suggestions November 22, 2015

Users upgrading to hlint 1.9.23 will now be able to take advantage of the new --refactor flag which by invoking the refactor executable supplied by apply-refact can automatically apply suggestions.

• Announcing ghc-exactprint: A New Foundation For Refactoring Tools July 23, 2015

Over the last few months Alan Zimmerman and myself have been working on what will hopefully become a new foundation for refactoring Haskell programs. We have called this foundation ghc-exactprint and it is now available on hackage to coincide with the release of GHC 7.10.2.

Thompson and Reinke originally described 22 refactorings in their catalogue of functional refactorings which motivated the development of HaRe. Missing from their list is the identity transformation, in the context of refactoring this is perhaps the most important. When applying any kind of change to small segment of your project it is undesirable for the tooling to modify another part of your file unexpectedly. The identity refactoring seems to be the easiest of all but it is important that any refactoring tool behaves in this way.

The biggest challenge of the last few months was being able to perform the identity refactoring whilst retaining a suitable representation to be able to easily transform programs. Now that we believe that ghc-exactprint is robust, the challenge is to build the promised refactoring tools upon it.