This is a fascinating thread. I want to add that I’m in a similar camp as @simonpj on this, as expressed in his post.
I strongly believe that the future leads through dependent types. Indeed, I’ve come to view non-dependent types as quite a strange way to set up a programming language. If a language should have types at all, it should have dependent ones: otherwise, some of the ideas you wish to express are inexpressible. But – in some contrast to the me of 5 years ago – I’ve come to be more skeptical of adding dependent types to Haskell as it exists today.
Suppose we’re renovating our castle. We know that a beautiful tower placed just there will be a sight to behold – and will give us a wonderful view, both for pleasure and for sound defensive strategy. I was part of the team that planned out the tower and worked on convincing many of where it should be placed and why it would be so nice to have. Yet, as I’ve been actually constructing the tower, I’ve noticed that the part of the castle under which the tower will go is not quite so soundly built. There are parts of the castle that are already crumbling, and others which are fine today, but probably won’t support the weight of the tower. This all means that we probably shouldn’t proceed, today, with tower-building. Instead, we should work on building up the structure underneath the tower so that it will support that tower well and for a long time.
Returning back to dependent types: the support for dependent types is not strong enough yet in Haskell to support it. There are at least two dimensions to this:
- The code within GHC still needs to be cleaned out in order to become more extensible. This is underway in a variety of directions (e.g. for the cognoscenti: the new
HsExpansion
plan, adding support for proper predicates, making type families compute faster, adding support for HsType GhcTc
, and probably more I’m overlooking).
- The user-facing interface to the language needs to be more accessible. While I can claim (and do!) that adding dependent types need not worsen any existing error messages, I’ve come to agree that adding the feature will make the language harder to learn – at least in the first iteration of dependent types. Dependent types are new and strange to many. (I claim they can be seen as simpler than non-dependent types, but that won’t help the legions of people coming to Haskell from other typed languages.) Haskell is already unnecessarily hard to get into. It comes with too many unfamiliar concepts, and there is not a good way to discover how these concepts fit together. Fixing this well will require educational resources, improved IDEs, and better error messages.
Perhaps once these foundational issues are sorted out, we’ll be in a better position to build actual dependent types.
This does not mean work should stop! Indeed, the current proposals process – for all its apparent slowness – is doing an excellent job of figuring out where the current edifice is strong enough to support continued building. And so we continue to build in the direction of dependent types. At the same time, I’ve pivoted somewhat to focus more on user experience, knowing that others (hat tip to @int-index and his collaborators who, among others, are pushing this forward) are doing the work on dependent types directly.
So work continues apace. Some of it is invisible (refactorings within GHC), just like one might expect in a renovation of a structure where new weight will be added on top. Some of it is user-facing (I think the improvements in HLS are essential in order to support dependent types properly). But I do think we will – almost inevitably – get there in the end.