Informally speaking, Euclidean is a superclass of Integral, lacking toInteger, which allows to define division with remainder for a wider range of types, e. g., complex integers and polynomials with rational coefficients.
Euclidean represents a Euclidean domain endowed by a given Euclidean function degree.
No particular rounding behaviour is expected of quotRem. E. g., it is not guaranteed to truncate towards zero or towards negative infinity (cf. divMod), and remainders are not guaranteed to be non-negative. For a faithful representation of residue classes one can use mod package instead.
Methods
quotRem :: a -> a -> (a, a)Division with remainder.
Property \x y -> y == 0 || let (q, r) = x `quotRem` y in x == q * y + rquot :: a -> a -> ainfixl 7Division. Must match its default definition:
Property \x y -> quot x y == fst (quotRem x y)rem :: a -> a -> ainfixl 7Remainder. Must match its default definition:
Property \x y -> rem x y == snd (quotRem x y)degree :: a -> NaturalEuclidean (aka degree, valuation, gauge, norm) function on
a. UsuallyfromIntegral . abs.degree is rarely used by itself. Its purpose is to provide an evidence of soundness of quotRem by testing the following property:
Property \x y -> y == 0 || let (q, r) = x `quotRem` y in (r == 0 || degree r < degree y)
Instances22Euclidean, …
Euclidean IntegerDefined in semirings-0.7 · Data.EuclideanEuclidean NaturalDefined in semirings-0.7 · Data.EuclideanEuclidean CDoubleDefined in semirings-0.7 · Data.EuclideanEuclidean CFloatDefined in semirings-0.7 · Data.EuclideanEuclidean Int16Defined in semirings-0.7 · Data.EuclideanEuclidean Int32Defined in semirings-0.7 · Data.EuclideanEuclidean Int64Defined in semirings-0.7 · Data.EuclideanEuclidean Int8Defined in semirings-0.7 · Data.EuclideanEuclidean Word16Defined in semirings-0.7 · Data.EuclideanEuclidean Word32Defined in semirings-0.7 · Data.EuclideanEuclidean Word64Defined in semirings-0.7 · Data.EuclideanEuclidean Word8Defined in semirings-0.7 · Data.EuclideanEuclidean DoubleDefined in semirings-0.7 · Data.EuclideanEuclidean FloatDefined in semirings-0.7 · Data.EuclideanEuclidean IntDefined in semirings-0.7 · Data.EuclideanEuclidean WordDefined in semirings-0.7 · Data.EuclideanEuclidean Mod2Defined in semirings-0.7 · Data.EuclideanEuclidean ()Defined in semirings-0.7 · Data.EuclideanFractional a => Euclidean (WrappedFractional a)Defined in semirings-0.7 · Data.EuclideanIntegral a => Euclidean (Ratio a)Defined in semirings-0.7 · Data.EuclideanIntegral a => Euclidean (WrappedIntegral a)Defined in semirings-0.7 · Data.EuclideanField a => Euclidean (Complex a)Defined in semirings-0.7 · Data.Euclidean