ianmackenzie / elm-units

Simple, safe and convenient unit types and conversions for Elm
https://package.elm-lang.org/packages/ianmackenzie/elm-units/latest/
BSD 3-Clause "New" or "Revised" License
84 stars 14 forks source link

#6 Add Density module #18

Closed katjam closed 5 years ago

katjam commented 5 years ago

Awaiting decision on for which units we want conversions.

Candidates to consider from: https://en.wikipedia.org/wiki/Density#Common_units -and- https://github.com/ianmackenzie/elm-units/blob/master/src/Volume.elm

@ianmackenzie thoughts?

ianmackenzie commented 5 years ago

Based on a quick look around various material property websites (and, to be honest, just some of my own personal experience), I think I'd start with:

I think that covers the most common cases, and it's easy enough to add more on request. How does that sound?

katjam commented 5 years ago

Looks good to me. As you say - we can add more easily, if need becomes apparent.

katjam commented 5 years ago

I'll be using some same constants as Mass and Volume. So far we've kept all the modules independent which I think is good - but feels odd to be repeating them without making reference to use elsewhere, or reusing/ sharing.

I'll hopefully have time to slot this in tonight - see what you think.

ianmackenzie commented 5 years ago

Might make sense to add a non-exposed Constants module...as well as avoiding duplication it would nice to have a central place to note down where each constant was taken from. Thoughts?

katjam commented 5 years ago

I was thinking exactly that but should we do as a new issue/ refactor?

ianmackenzie commented 5 years ago

Yes, I think so - just logged as #19. So do whatever is simplest for Density for now and we can migrate to a Constants module later. (If it's easiest to add a Constants module as part of this pull request and only add mass/volume constants in there for now, I think that would be OK - then we can migrate over other modules separately.)

katjam commented 5 years ago

@ianmackenzie Ready for review.

ianmackenzie commented 5 years ago

Sorry for the delay, still trying to get back into a normal routine - looks good!