tomahawkins / engineering-units

A numeric type to automatically manage engineering units in Haskell.
Other
6 stars 2 forks source link

Added SI prefix names and symbols. #1

Open fluffynukeit opened 9 years ago

fluffynukeit commented 9 years ago

First, a little aside: I love the design of this library. I made a units library following a similar strategy for Matlab at work, but this is way more slick with typeclasses and good unit tracking. I think it fits into a nice space compared to the way more complicated units libraries (e.g. dimensional, NumericPrelude). I have some ideas for possible improvements that I'll write about in a separate issue.

This PR adds the SI unit prefixes and their symbols as value transformers, so centimeter can be written as (centi m) or (_c m). I also updated some of the unit definitions to use the symbols as an example.

My files are auto-formatted with stylish haskell, which is why there are seemingly silly white space changes. The PR also pushes source into a high level src directory, consistent with the default behavior of cabal init. I had to do this to get the library to build on NixOS, but I believe it's also the more widely used convention.