On Tue, 1 Mar 2022, PICCA Frederic-Emmanuel wrote:
Hello, I try to write some code use to parse an ini file for one of my softwares, using config-ini[1].
In this config file I have scientific values with units, meter, angstrom, degrees, etc... So I created a bunch of newtype in order to deal with this part of the config file
newtype Meter = Meter (Length Double) deriving (Eq, Show)
newType Angstrom = Angstrom (Length Double)
[...]
I would define newtype Quantity dimension a = Quantity a or use one of the libraries for physical dimensions. Then I would convert all values to SI standard units, i.e. all lengths to meter. If you must preserve the units from the config file, I would instead define newtype Quantity dimension unit a = Quantity a