GHC Status May 2011

GHC is still busy as ever. The GHC 7.0 branch has come and gone, and now that the branch has been closed we have finally made the long-planned switch from darcs to git. Meanwhile, we are busily working towards the 7.2 branch, and hope to make the 7.2.1 release in June. Some of the forthcoming highlights are:

Simon PJ: New coercions

Simon PJ: generics

Simon PJ: Any update? Any regressions remaining? Previous entry: As long promised, Simon PJ and Dimitrios have spent a good chunk of the summer doing a complete rewrite of the constraint solver in the type inference engine. Because of GHC's myriad type-system extensions, especially GADTs and type families, the old engine had begun to resemble the final stages of a game of Jenga. It was a delicately-balanced pile of blocks that lived in constant danger of complete collapse, and had become extremely different to modify (or even to understand). The new inference engine is much more modular and robust; it is described in detail in our paper ​http://haskell.org/haskellwiki/Simonpj/Talk:OutsideIn OutsideIn. A blog post describes some consequential changes to let generalisation ​http://hackage.haskell.org/trac/ghc/blog/LetGeneralisationInGhc7 LetGen.

As a result we have closed dozens of open type inference bugs, especially related to GADTs and type families.

Stephanie Weirich and Steve Zdancewic had a great sabbatical year at Cambridge. One of the things we worked on, with Brent Yorgey who came as an intern, was to close the embarrassing hole in the type system concerning newtype deriving (see Trac bug #1496). I have delayed fixing until I could figure out a Decent Solution, but now we know; see our 2011 POPL paper ​http://www.cis.upenn.edu/~sweirich/newtypes.pdf Newtype. Brent is working on some infrastructal changes to GHC's Core language, and then we'll be ready to tackle the main issue.

Next after that is a mechanism for promoting types to become kinds, and data constructors to become types, so that you can do typed functional programming at the type level. Conor McBride's SHE prototype is the inspiration here ​http://personal.cis.strath.ac.uk/~conor/pub/she/ SHE. Currently it is, embarrassingly, essentially untyped.

Iavor Diatchki plans to add numeric types, so that you can have a type like Bus 8, and do simple arithmetic at the type level. You can encode this stuff, but it's easier to use and more powerful to do it directly.

David Mazieres at Stanford wants to implement Safe Haskell, a flag for GHC that will guarantee that your program does not use unsafePerformIO, foreign calls, RULES, and other stuff stuff.

Packages and the runtime system

Simon Marlow: any update? Previous entry: Simon Marlow is working on a new garbage collector that is designed to improve scaling of parallel programs beyond small numbers of cores, by allowing each processor core to collect its own local heap independently of the other cores. Some encouraging preliminary results were reported in a ​blog post. Work on this continues; the complexity of the system and the number of interacting design choices means that achieving an implementation that works well in a broad variety of situations is proving to be quite a challenge.

The new code generation backend (-fuse-new-codegen, the rewrite of the part of GHC that turns STG syntax into C--) has seen a flurry of work, spearheaded by Edward Z. Yang. At this point, we’ve ironed out most of the bugs in the backend, and now we’re working on new optimization passes and fixing inefficiencies to get the generated code as good (or better) than the old code generator. We’re still not at the point where the new code generator will generate better code, but we’re pretty close!

The Parallel GHC Project

Microsoft Research is funding a 2-year project to develop the real-world use of parallel Haskell. The project is now underway with four industrial partners:

Dragonfly (New Zealand)

IIJ Innovation Institute Inc. (Japan)

Los Alamos National Laboratory (USA)

Willow Garage Inc. (USA)

with consulting and engineering support from Well-Typed. Each organisation is working on its own particular project making use of parallel Haskell. The overall goal is to demonstrate successful serious use of parallel Haskell, and along the way to apply engineering effort to any problems with the tools that the organisations might run into.

For more details, see the link:parallel GHC project entry.

Data Parallel Haskell

The main user-visible development concerning data-parallel programming with GHC since the last status report is the release of our library for regular, multi-dimensional, shape-polymorphic arrays: ​http://hackage.haskell.org/package/repa Repa. The current release on Hackage performs well with GHC 7.0.3 and already includes Ben's recent work on high-performance stencil-based convolutions — see also the draft paper ​Stencil and Ben's screencast ​http://code.ouroborus.net/beholder/video/Edge480.mov EdgeDetect of a real-time edge detection application, written in Objective-C and Haskell, using the new Repa library.

We have pushed back the release of a stable version of the main DPH libraries again. They are now scheduled to be released with the forthcoming GHC 7.2.