Reorganize the names and modules.
Closed this issue · 11 comments
Thanks to the initial joyful development, now the core features are settled but the modules are bit disorganized (as often happens). For example classes Dimension
and Unit
are both defined in Data.Dimensions.Units
. The data type Dim
defined in Data.Dimensions.Dim
expresses quantity rather than dimension. Modules Data.Quantity.*
are obsolete and are to be removed.
To save the future users and developers of units
from confusion, I think I'll take a night and reorganize the modules. This kind of renamings come with pain and are always controversial, but if done at earlier stage less is the pain.
I'll first wait for any opinions.
Yes, I think this is a good idea. If you want, you can also shore up some of the documentation, making sure it is still current w.r.t. the implementation.
I'll admit I wondered why you favored Qu
over Dim
, but with the explanation above, it's obvious. I'm happy for you to make that change.
Other name changes: as long as it's systematic, I'm happy. I will say I like vector-spaces
's approach, using a symbol on either side of an operator to indicate type. So, we could have, say |+|
add two Qu
s but *|
multiply by a scalar (on the left).
Thank you Richard, for your approval! And sure, I will look over the documentations.
And Richard, people (including me) have different taste of naming and If I were you I would also have found difficulty understanding the naming. Thank you for understanding! Let us do our best explain the concepts and give references in the documentations.
Operator namings are more difficult where we have less choice of characters. |*|
and .*
series have different merits and I'm thinking of supporting both styles in separate modules. (Maybe .*
can go to units-extras
library)
Speaking of removing user confusions, I'm thinking of module names Data.Metrology.*
Since metrology is the science of measurement, it covers the concept of dimensions, units, and quantities. Also, we are drawing terminology from the document "International Vocabulary of Metrology (VIM)". Finally, we have never used the word Metrology
before, so it's easy to search&replace it once we've decided for another name.
OK. You make a good argument for the switch to Metrology. And, you can switch back some of the names used in the SI definitions (Quantity
-> AmountOfSubstance
, and luminosity). I had gotten those names from some official source, but I can't seem to find it now, and I find the names that you used, instead.
Thank you Richard again, for your understanding. Every people (including me) are proud of his/her naming and I hate to be pedantic nor biblist. Rather, when several people's idea differ or confuse each other, I think it's a good idea to get advices from the fruits of old discussions such as VIM . As a physicist I thought as granted I knew about dimensions but in fact I'm learning a lot while writing this libraries. I'm eager to accept my own mistakes and better ideas. Especially, SI is not a complete system and many updates are proposed.
As for the dimension Quantity
I was afraid it is confusing with the concept of quantity.
I'm careful about and grateful to this library because I'll use this for a long time!
A branch (rename)[https://github.com/goldfirere/units/tree/rename] is under preparation for merge.
Changes so far include:
- updates in documents (I admire Richard's concise work here)
Dim
is nowQu
, some utility functions are renamed accordingly (e.g.quOf
andvalIn
.)Data.Metrology.Type
that exports type synonyms for system-independent dimensionsUnitCombinators
are nowCombinators
because we now use them for both units and dims
Do you think we should rename data DimSpec = D star Z
too, since it's also used for both units and dims? Any suggestion for the name?
Remaining works are operator renames and Readme updates.
As a result of brief survey I found out that our dot-operator series .+
.*
... do not overlap with most of the existing libraries I'm going to use units with (which removed my prejudice).
- http://hackage.haskell.org/package/lens-4.1.2/docs/doc-index-46.html
- http://hackage.haskell.org/package/hmatrix-0.15.2.1/docs/doc-index-All.html
- http://hackage.haskell.org/package/vector-space-0.8.6/docs/doc-index.html
- http://hackage.haskell.org/package/repa-3.2.3.3/docs/doc-index-All.html
- http://hackage.haskell.org/package/vector-0.10.9.1/docs/doc-index.html
- http://hackage.haskell.org/package/accelerate-0.14.0.0/docs/doc-index-All.html
Please anyone comment on the libraries to be added to the above list.
My current idea is to keep the current term-level operators as-is and, if in need, support alternative set(s) of operators in units-extra
.
What about changing DimSpec
to Factor
and D
to F
? The name isn't terribly important here, because DimSpec
s aren't exported from Data.Metrology
. (Though they are exported from Data.Metrology.Poly
.)
OK. If you like the .+
, etc., names, I'm fine, too.
Done DimSpec
-> Factor
. Would you have a look at rename
branch and merge it if it's okay? Or tell me if any problem.
Merged. Thanks!