#4019: deriving Ord can produce incorrect and inefficient instances
---------------------------------+------------------------------------------
Reporter: rl | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.13
Keywords: | Difficulty:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: Incorrect result at runtime
Patch: 0 |
---------------------------------+------------------------------------------
Comment(by simonpj):
It's easy enough for me to generate whatever code we want for Ord
instances. Would someone like to write down what GHC should generate?
There appear to be two issues:
* Efficiency: this may just be a question of generating explicit code
rather than relying on default methods. That's fine with me: can someone
please specify what would do the job? You can see what GHC does right now
with `-ddump-deriv`
* Correctness: if comparisons involving !NaNs always False, then it is
possible for a>b and b>a to both be true, even though a and b differ,
which breaks one of the properties of a total order. I'm not sure what
to do here. Does anyone else know?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4019#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs