Deferring Type Errors to Runtime
Sign up for weekly Clojure tips, software design, and a Clojure coding challenge.
Reference: Deferring Type Errors to Runtime
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 altered^1, since the compiler was always looking for consistent types. There were ways to work around it^2, 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.
This is the classical definition of tight coupling. That's right: static typing introduces coupling.[↩](#fnref1) 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.[↩](#fnref2)