Herbert Graeber writes:

> I have found another useful application of types with value
> parameters in C++. I have seen an example of using types to check
> for proper use of physical units. I have found this very useful. But
> I haven't found a way to express this in haskell. It would be nice
> to have a type system, that supports that and similar applications.

You might be interested in the work of Andrew Kennedy on dimension
types in ML.  This involves inferring polymorphic types to express
physical dimensions (mass, length, time).  For higher-order
functions you get outcomes like a correct type for differentiation.
The type inference problem is harder than Hindley-Milner, as
multiplication of dimension types must be associative and
commutative.  (10 kg m/s = 10 m kg/s)  


Andrew J. Kennedy.  Dimension Types. In ESOP '94: Proceedings of the
  Fifth European Symposium on Programming, Lecture Notes in Computer
  Science 788.  Springer-Verlag, 1994

  Available electronically from the out-of-date home page 
  http://www.cl.cam.ac.uk/~ajk13/

Andrew J. Kennedy.  Programming Languages and Dimensions.  PhD
  thesis, University of Cambridge, November 1995.  Also published as
  Technical Report 391,  University of Cambridge Computer
  Laboratory.

  For a copy, send email to <[EMAIL PROTECTED]>

--------------------------------------------------------------------
Dr Ian Stark                                Office: 2506
Division of Informatics                     Tel: 0131 650 5143
The University of Edinburgh                 Fax: 0131 667 7209
James Clerk Maxwell Building              
King's Buildings, Mayfield Road             Email: [EMAIL PROTECTED]
Edinburgh EH9 3JZ
Scotland                           http://www.dcs.ed.ac.uk/home/stark
--------------------------------------------------------------------


Reply via email to