
On Tue, 17 Feb 2009, Sterling Clover wrote:
Something that hit me tonight: Last GSoC gave us GHC compiler plugins.
Never heard of it. Sometimes I thought it would be nice to modify or extend GHCs error messages by libraries in order make they feel more like domain specific languages. E.g. instead of or additionally to saying 'type A infered, but type B expected' it could state 'you have probably made the common error to use function f instead of (uncurry f)'. Is this possible with compiler plugins?
Plugins, in essence, as I understand them, let us extend the type system in useful ways. Haskell has libraries for units[1], but no lightweight (i.e. without simulated dependent types or a dsl) way to embed units in Haskell calculations. Units in a functional language are possible, and implemented in, e.g., F# [2]
I think units as separate extensions are not a good goal. The type system should be made strong enough to handle this application without hassle.
[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dimensional, http://liftm.wordpress.com/2007/06/03/scientificdimension-type-arithmetic-an..., http://hackage.haskell.org/cgi-bin/hackage-scripts/package/caldims
There is also both dynamic and static unit checking in NumericPrelude: http://haskell.org/haskellwiki/Physical_units