removing constraints

Ross Paterson R.Paterson at city.ac.uk
Fri Jan 9 15:25:29 UTC 2015


Recent changes to avoid warnings have removed some constraints from
module interfaces:

* in Data.Array, Ix i was removed from:

    instance Ix i => Functor (Array i)
    instance Ix i => Foldable (Array i)
    bounds :: Ix i => Array i e -> (i,i)
    elems :: Ix i => Array i e -> [e]

* in Data.Ratio, Integral a was removed from:

    instance (Integral a, Show a) => Show (Ratio a)
    numerator :: (Integral a) => Ratio a -> a
    denominator :: (Integral a) => Ratio a -> a

These constraints are not needed by the GHC implementations, but might be
needed for other possible implementations, so in a sense the changes are
leaking the GHC implementations.  This seems most clear in the Functor
and Foldable instances for Array, and elems.  Portable implementations
of these will require the Ix constraint -- I think it should be restored.

The other cases are more arguable.  For example the change to Data.Ratio
declares that the pair is kept in reduced form, but one could argue that
requiring that is no bad thing.


More information about the Libraries mailing list