bjornbm / dimensional

Dimensional library variant built on Data Kinds, Closed Type Families, TypeNats (GHC 7.8+).
BSD 3-Clause "New" or "Revised" License
102 stars 16 forks source link

Define collections of all published units #205

Open dmcclean opened 5 years ago

dmcclean commented 5 years ago

I would like the Numeric.Units.Dimensional.SIUnits and Numeric.Units.Dimensional.NonSI modules to provide monomorphic collections of all unit definitions published therein, for use by downstream packages that perform unit parsing.

Perhaps this is best done through a simple [AnyUnit], or perhaps the Numeric.Units.Dimensional.Dynamic module should export some sort of UnitSet that enforces uniqueness of names by some strategy, I'm not sure?

Also unsure whether publishing a single monolithic collection per module is the best approach or whether a further attempt should be made to curate them into smaller groups.

bjornbm commented 5 years ago

I don't have any objections or strong feelings about the direction to take. Reusing what we have without introducing new types might be more economical in terms of exposed API?

I don't see a problem with a single collection for SIUnits as it is well . NonSI on the other hand is quite open-ended so I'm not so sure what is the right approach… maybe a single collection as well until a concrete need arises for groups?

You have the use case clearer in your mind so feel free to draft a design you think would work for you. As I said I have no objections. Perhaps these monomorphic collections could be provided by other modules instead of adding to the existing ones, something like Numeric.Units.Dimensional.SIUnits.{Monomorphic,Dynamic} instead of Numeric.Units.Dimensional.SIUnits?

dmcclean commented 5 years ago

OK, I have a draft on this that I will submit soon.