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

Add percent as a unit #201

Closed dmcclean closed 5 years ago

dmcclean commented 5 years ago

Here's the definition of percent to play around with and see if we like it.

dmcclean commented 5 years ago
> putStrLn $ showIn percent (_3)
300.0 %
> putStrLn $ showIn percent (0.37 *~ one)
37.0 %
> putStrLn $ showIn (percent * percent) (0.37 *~ one)
3700.0 % %
bjornbm commented 5 years ago

Thanks, the 3700 % % doesn't look too great but I guess if that is what you ask for…

dmcclean commented 5 years ago

Yeah, you get what you ask for, but I do think that some kind of opt-in warning system will be nice for dynamic uses.

bjornbm commented 5 years ago

Do you want to add this, too, in the next release, or did you want to play with it more first? I'm fine with merging it.

dmcclean commented 5 years ago

I have lingering doubts about it, but it seems useful enough for my controls work to be worth it. Merging.

bjornbm commented 5 years ago

If we decided to have percent how about also adding permille (‰) and permyriad (‱)? Granted they are less common but won't break anything not already broken by %.

dmcclean commented 5 years ago

Fine by me. I don't think I object to obscure or disused units, only ill-defined ones or ones with dimensions we don't model well.

On Fri, Dec 21, 2018, 3:00 PM Björn Buckwalter <notifications@github.com wrote:

If we decided to have percent how about also adding permille (‰) and permyriad (‱)? Granted they are less common but won't break anything not already broken by %.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/bjornbm/dimensional/pull/201#issuecomment-449485008, or mute the thread https://github.com/notifications/unsubscribe-auth/AAk00_z4g5jKK8inORVQcwX-E92FClHjks5u7T3agaJpZM4ZaJYf .