
4 Nov
2008
4 Nov
'08
3:22 p.m.
On Mon, Nov 3, 2008 at 3:53 PM, Daniel Fischer
Am Dienstag, 4. November 2008 00:26 schrieb Michael Snoyman:
Beware! Multiplication is usually not commutative, think about matrices. If (a `mult` b) and (b `mult` a) are both defined (need not be if they have different types), the products may have different types, so in general it is not desirable to have both defined automatically in a way that doesn't force you to supply the arguments in the correct order.
In your case, you could provide instance Multiplicable MilesPerGallon Gallon Mile where mult = flip mult -- or write the implementation out and it should work whichever order the arguments are passed.
Good point. Thanks for all the help!