Closed goldfirere closed 10 years ago
At least, the following works for the moment:
ratio :: (Normalize (Reorder d1 d2 @@- d2) ~ '[], Fractional n)
=> Qu d1 l n -> Qu d2 l n -> n
We can create a type synonym for Normalize (Reorder d1 d2 @@- d2) ~ '[]
, meaning that we can infer that the two dimensions cancel each other.
a runnable example: https://github.com/nushio3/practice/blob/master/units/ratio.hs
Yes -- what you wrote was what I had in mind for @~
. The outstanding question for me is whether the new @~
works in all cases where the old one did. My guess is "yes", but we have to test. This is where I wish we had a test suite.
I want this to work:
But it doesn't, because
d1 @~ d2
does not imply thatNormalize (d1 @- d2) ~ '[]
. Perhaps a different definition of@~
would work.