[Haskell-cafe] Haskell.org GSoC - Units

Henning Thielemann lemming at henning-thielemann.de
Wed Feb 18 17:02:46 EST 2009

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-and-physical-units-in-haskell/,
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/caldims

There is also both dynamic and static unit checking in NumericPrelude:

More information about the Haskell-Cafe mailing list