Re: [Haskell-cafe] Haskell.org GSoC - units

2009-02-20 Thread Henning Thielemann


On Thu, 19 Feb 2009, Sterling Clover wrote:

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.


I think it is widely agreed on that all these static checkers (e.g. for 
totality of functions) fill the gap of a type system that is not strong 
enough to handle these cases. Have you ever tried one of the 
units-by-types libraries so far? They catch many bugs and are already 
quite natural in usage.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell.org GSoC - Units

2009-02-18 Thread Henning Thielemann


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:
  http://haskell.org/haskellwiki/Physical_units
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe