Deferring Type Errors to Runtime

September 07, 2012

Haskell just got a whole lot more useful for prototyping. One of my biggest gripes with Haskell was how much code had to be changed if a single type was altered1, since the compiler was always looking for consistent types. There were ways to work around it2, but they were always tedious and unsatisfactory.

This new development in 7.6 lets you compile and run the code, changing type signatures many times, before you have to propagate the change through the rest of the code.

  1. This is the classical definition of tight coupling. That's right: static typing introduces coupling.

  2. How to do it? Never change a type signature. Instead, create a new name with the same value, and modify that. Then, when it has settled into its permanent type signature, rename it to the old name, recompile, and let the error messages guide you.