[Haskell-cafe] Haskell.org GSoC

Sterling Clover s.clover at gmail.com
Thu Feb 19 23:05:46 EST 2009


On Feb 18, 2009, at 4:43 AM, Max Bolingbroke wrote:

> 2009/2/18 Sterling Clover <s.clover at gmail.com>:
>> The punchline: With GHC plugins, it should be possible, and  
>> reasonable, to
>> add a proper unit system for Haskell.
>
> Alas, GHC plugins cannot change the type system - only meddle with the
> compilation strategy or analyse the code and suchlike. I'm working
> with Simon Peyton Jones to get plugins integrated fully into GHC
> (parts of it have been commited already) but we're both busy and so
> progress is slow. I don't think any GSoC projects should take a
> dependency on it being both integrated into GHC and stable in time for
> the summer.
>

Thanks for the update on plugins! I look forward to trying them out  
from the GHC mainline at some point. I don't think that units as I  
envision them would need to mess with the type system directly, but  
could be implemented simply as a static analysis step, such as you  
describe. Units really do something quite different from standard  
types, and unit-correctness seems orthogonal to type correctness. A  
simple plugin would, e.g., allow unit annotations as distinct from  
type annotations (although, with an appropriate preprocessor step,  
they could, with cleverness, be written jointly), and simply track  
unit usage throughout the code to ensure correctness. It would, I  
assume, only need to operate on things which belonged to the Num  
typeclass to begin with, and assume that all unannotated numbers were  
scalars. Even lacking any sophisticated features, I would find this  
very useful, and certainly easier to envision than a more general  
extension to the type system that made unit tracking feasible, but  
yet, somehow, didn't veer fully into either simulated or actual  
dependent typing.

So I guess I'll just keep this idea in mind and pitch it for next  
year's GSoC. :-)

Cheers,
Sterl.


More information about the Haskell-Cafe mailing list