Restore invariant in `Data (Ratio a)` instance

Authored by hvr.

Description

Restore invariant in Data (Ratio a) instance

The Data instance for Ratio just uses the raw :% constructor and
doesn't check that the result is reduced to normal form.

The fix is to add back the Integral constraint on the Data
instance (which was dropped in c409b6f30373535) and to use % rather
than :% in the gfoldl and gunfold implementation.

This restores the invariant and matches the behavior of "virtual
constructors" we've used to patch up such problems elsewhere.

This addresses Trac #10011

(cherry picked from commit 79b0d0e633af8302d2dd907663a4a231cd889b67)

Details

Committed
hvrJan 21 2015, 12:33 PM
Parents
rGHCa993712d1669: CMM: add a mechanism to import C .data labels
Branches
Unknown
Tags
Unknown