Overflow in Ratio

Ian Lynagh igloo at earth.li
Sun Jul 22 12:16:50 EDT 2007


On Sat, Jul 21, 2007 at 04:03:38PM +0000, David Benbennick wrote:
> 
> I submitted a complete patch at
> http://hackage.haskell.org/trac/ghc/ticket/1517, but that was
> apparently the wrong place, since the bug was closed as wontfix.

For those who haven't read the bug log, here is the closure message:

Thanks for the patch, but I see a couple of problems:

* This would give different behaviour to what the Haskell 98 report
  specifies
* This would give unexpected behaviour if the Ord or Num instance
  for your ratio type don't match those for Integer 

I don't have a good solution, I'm afraid. I think we just have to accept
that anything involving Int has these sorts of problems.

For example, you could equally say that

x > 0 => y + x > y

should hold, but it doesn't due to Int wrapping.

If you still think that this change should be made then I think that it
should go through the library submissions process:
http://www.haskell.org/haskellwiki/Library_submissions


Thanks
Ian



More information about the Libraries mailing list