[Haskell] [ANN] quantities 0.3.0
John David Reaver
jdreaver at adlerhorst.com
Tue Apr 15 19:29:02 UTC 2014
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.
>From the description on Hackage:
A library for creating and manipulating physical quantities,
which are a numerical value associated with a unit of
measurement. Included is an expression parser and a huge list
of predefined quantities with which to parse strings into a
Quantity datatype. Once created, a quantity can be converted
to different units or queried for its dimensionality. A user
can also operate on quantities arithmetically, and doing so
uses automatic unit conversion and simplification.
Just to get a taste of how this package works, here are some
examples:
>>> fromString "25 m/s"
Right 25.0 meter / second
>>> fromString "fakeunit"
Left (UndefinedUnitError "fakeunit")
>>> fromString "ft + 12in"
Right 2.0 foot
>>> fromString "min => s"
Right 60.0 second
>>> fromString "2 ft + 6 in => ft"
Right 2.5 foot
>>> fromString "5 m => s"
Left (DimensionalityError [length] [time])
>>> convertBase <$> fromString "N * m"
Right 1000.0 gram meter ** 2 / second ** 2
>>> dimensionality <$> fromString "N * m"
Right [length] ** 2 [mass] / [time] ** 2
Finally, this is my first Haskell library. I am open to *any*
suggestions/criticism, especially in regards to code style, the API,
the cabal file structure, etc.
Thanks,
John David Reaver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell/attachments/20140415/8a60919a/attachment.html>
More information about the Haskell
mailing list