[Haskell-cafe] quantities 0.3.0

Henning Thielemann schlepptop at henning-thielemann.de
Tue Apr 15 20:05:32 UTC 2014


Am 15.04.2014 21:29, schrieb John David Reaver:
> Hello! I am happy to publicly announce the quantities package:
>
>     Hackage: http://hackage.haskell.org/package/quantities
>     Github: https://github.com/jdreaver/quantities
>
> I feel this package is complete enough as of version
> 0.3.0 (released today) to announce it to the public.

I have programmed something similar years ago, first for Haskell 98 
numeric classes and then for numeric-prelude. My implementation does not 
use an expression tree for the physical dimensions. Instead it uses a 
vector of base dimensions and constructs reasonable units only for 
string output.

http://hackage.haskell.org/package/numeric-prelude-0.4.1/docs/Number-SI.html

You can play around with it by unpacking the numeric-prelude package and 
run 'make ghci'

thielema at sputnik:/tmp> cabal unpack numeric-prelude
Unpacking to numeric-prelude-0.4.1/
thielema at sputnik:/tmp> cd numeric-prelude-0.4.1/
thielema at sputnik:/tmp/numeric-prelude-0.4.1> make ghci
...
*Main> 25*meter/second :: SIDouble
...
25.0 m/s
*Main> minute/second :: SIDouble
60.0
*Main> ampere*volt :: SIDouble
1.0 W

There are many more libraries for handling of physical dimensions:
    http://www.haskell.org/haskellwiki/Physical_units

You may add 'quantities' there.



More information about the Haskell-Cafe mailing list