
#8695: Arithmetic overflow from (minBound :: Int) `quot` (-1) ------------------------------------------------+-------------------------- Reporter: rleslie | Owner: Type: bug | Status: patch Priority: normal | Milestone: 7.8.1 Component: libraries/haskell2010 | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result at runtime | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: #1042 ------------------------------------------------+-------------------------- Comment (by rwbarton): Edward, to be a Euclidean domain, `Int` would first of all have to be a domain, which it is not. (I don't think this is nit-picking because there are usually several possible definitions of concepts like "Euclidean domain", which are equivalent under the assumption (here) that the ring is an integral domain. It's potentially more or less an accident which equivalent definition becomes accepted as The Definition, and there's no reason to think it has any distinguished status when the assumption is broken.) The algebraic law that I expect from division with limited-range numeric types is
if `a, b, c :: Int` and `div a b == c` then `div (toInteger a) (toInteger b) == toInteger c`.
In my opinion this is a lot more useful than a law involving `fromInteger :: Integer -> Int`, which doesn't play nicely with division. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8695#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler