-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quoted unit functions don't compose. #72
Comments
I've left the reproduction in the tutorial for now. uom-plugin/uom-plugin/doc/Data/UnitsOfMeasure/Tutorial.hs Lines 249 to 265 in 287dde9
|
This is a very good observation. At the moment we have [u| m |] :: a -> Quantity a (Base "m") Instead, I think we should change this to: [u| m |] :: Quantity a u -> Quantity a (Base "m" *: u) That is, when the quasiquoter is used in an expression without a number, it produces a function that multiplies a polymorphic value by the given units. Since literals are dimensionless, I think we get this: [u| m |] 1 == [u| 1 m |] :: Num a => Quantity a (Base "m")
[u| m |] $ [u| s^-2 |] 9.8 == [u| 9.8 m s^-2 |] :: Fractional a => Quantity a [u| m s^-2 |]
[u| m s^-2 |] :: Quantity a u -> Quantity a ([u| m s^ -2 |] *: u) |
The text was updated successfully, but these errors were encountered: