HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulenumeric-prelude-0.4.4Haskell98

Algebra.RealIntegral

Generally before using quot and rem, think twice. In most cases divMod and friends are the right choice, because they fulfill more of the wanted properties. On some systems quot and rem are more efficient and if you only use positive numbers, you may be happy with them. But we cannot warrant the efficiency advantage.

See also: Daan Leijen: Division and Modulus for Computer Scientists http://www.cs.uu.nl/%7Edaan/download/papers/divmodnote-letter.pdf, http://www.haskell.org/pipermail/haskell-cafe/2007-August/030394.html

  • 1 class
classclass (C a, C a, Ord a, C a) => C a where
#

Remember that divMod does not specify exactly what a quot b should be, mainly because there is no sensible way to define it in general. For an instance of Algebra.RealIntegral.C a, it is expected that a quot b will round towards 0 and a div b will round towards minus infinity.

Minimal definition: nothing required

Methods

  • quot :: a -> a -> ainfixl 7
  • rem :: a -> a -> ainfixl 7
  • quotRem :: a -> a -> (a, a)
Instances16C, …
  • C IntegerDefined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C Int16Defined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C Int32Defined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C Int64Defined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C Int8Defined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C Word16Defined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C Word32Defined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C Word64Defined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C Word8Defined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C IntDefined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C WordDefined in numeric-prelude-0.4.4 · Algebra.RealIntegral
  • C TDefined in numeric-prelude-0.4.4 · Number.Peano
  • Integral a => C (T a)Defined in numeric-prelude-0.4.4 · MathObj.Wrapper.Haskell98
  • C a => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegative · orphan
  • C a => C (T a)Defined in numeric-prelude-0.4.4 · MathObj.Wrapper.NumericPrelude
  • (C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky