News for hackers. Stuff that matters.
Re:The Devil in Plain Text by scott_s on Monday May 13, 2013 @11:18AM (#5699130)
The Boost.Units library for C++ does this: http://www.boost.org/doc/libs/1_53_0/doc/html/boost_units/Qu...

Some examples from the documentation:

  quantity<length> L = 2.0*meters;
  quantity<energy> E = kilograms*pow<2>(L/seconds);

  quantity<plane_angle>    theta = 0.375*radians;
  quantity<dimensionless>  sin_theta = sin(theta);
  quantity<plane_angle>    thetap = asin(sin_theta);
I figured Haskell's type system could also do this sort of thing, and it can. I found Dimensional: https://code.google.com/p/dimensional/, but I'm not sure if it's in standard use in the Haskell community. Examples: https://code.google.com/p/dimensional/wiki/IspExample

There are no comments on this comment yet.