[GHC] #10011: The Data instance for Ratio violates internal invariants.
GHC
ghc-devs at haskell.org
Tue Jan 20 23:56:41 UTC 2015
#10011: The Data instance for Ratio violates internal invariants.
-------------------------------------+-------------------------------------
Reporter: ekmett | Owner: ekmett
Type: bug | Status: new
Priority: normal | Milestone:
Component: Core | Version: 7.10.1-rc1
Libraries | Operating System: Unknown/Multiple
Keywords: | Type of failure: None/Unknown
Architecture: | Blocked By:
Unknown/Multiple | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
I found this when Simon was cleaning up unused dependencies in
{{{
https://phabricator.haskell.org/rGHCc409b6f30373535b6eed92e55d4695688d32be9e#10730
}}}
The Data instance for Ratio just uses the raw `(:%)` constructor and
doesn't check that the result is reduced to normal form.
It strikes me that the fix is to add back the Integral constraint on the
Data instance and to use `(%)` rather than `(:%)` in the `gfoldl` and
`gunfold` code.
This restores the invariant and matches the behavior of "virtual
constructors" we've used to patch up such problems elsewhere.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10011>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list