3 ms·
"divide two integers so that the result has integer type when the numbers divide evenly, otherwise rational type." kazinatorDiv x y = case x `divMod` y of
by dllthomas 12y ago
"divide two integers so that the result has integer type when the numbers divide evenly, otherwise rational type."
kazinatorDiv x y = case x `divMod` y of
(q, 0) -> Left q
_ -> Right (x % y)