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

ModuleBoolean-0.2.4Haskell98

Data.Boolean.Numbers

A generalized version of the class hirarchy for numbers. All functions that would break a potential deep embedding are removed or generalized to support deep embeddings.

The class hierarchy for numeric types keeps as close as possible to the Prelude hierarchy. A great part of the default implementation and comments are copied and adopted from Prelude.

  • 4 classes
  • 3 values
  • PackageBoolean-0.2.4
  • Exports7
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceNumbers.hs
classclass Num a => NumB a where
#

An extension of Num that supplies the integer type of a given number type and a way to create that number from the integer.

Associated types

  • type family IntegerOf a

    The accociated integer type of the number.

Methods

Instances4NumB
  • NumB IntegerDefined in Boolean-0.2.4 · Data.Boolean.Numbers
  • NumB DoubleDefined in Boolean-0.2.4 · Data.Boolean.Numbers
  • NumB FloatDefined in Boolean-0.2.4 · Data.Boolean.Numbers
  • NumB IntDefined in Boolean-0.2.4 · Data.Boolean.Numbers
classclass (NumB a, OrdB a) => IntegralB a where
#

A deep embedded version of Integral. Integral numbers, supporting integer division.

Minimal complete definition is either quotRem and divMod or the other four functions. Besides that toIntegerB always has to be implemented.

Methods

  • quot :: a -> a -> a

    Integer division truncated towards zero.

  • rem :: a -> a -> a

    Integer reminder, satisfying: (x quot y) * y + (x rem y) == x

  • div :: a -> a -> a

    Integer division truncated toward negative infinity.

  • mod :: a -> a -> a

    Integer modulus, satisfying: (x div y) * y + (x mod y) == x

  • quotRem :: a -> a -> (a, a)

    Simultaneous quot and rem.

  • divMod :: a -> a -> (a, a)

    Simultaneous div and mod.

  • toIntegerB :: a -> IntegerOf a

    Create a integer from this integral.

Instances2IntegralB
classclass (NumB a, OrdB a, Fractional a) => RealFracB a where
#

Deep embedded version of RealFloat. Extracting components of fractions.

Minimal complete definition: properFraction, round, floor and ceiling.

Methods

Instances2RealFracB
classclass (Boolean (BooleanOf a), RealFracB a, Floating a) => RealFloatB a where
#

Deep embedded version of RealFloat. Efficient, machine-independent access to the components of a floating-point number.

A complete definition has to define all functions.

Methods

  • isNaN :: a -> BooleanOf a

    true if the argument is an IEEE "not-a-number" (NaN) value.

  • isInfinite :: a -> BooleanOf a

    true if the argument is an IEEE infinity or negative infinity.

  • isNegativeZero :: a -> BooleanOf a

    true if the argument is an IEEE negative zero.

  • isIEEE :: a -> BooleanOf a

    true if the argument is an IEEE floating point number.

  • atan2 :: a -> a -> a

    a version of arctangent taking two real floating-point arguments. For real floating x and y, atan2 y x computes the angle (from the positive x-axis) of the vector from the origin to the point (x,y). atan2 y x returns a value in the range [-pi, pi]. It follows the Common Lisp semantics for the origin when signed zeroes are supported. atan2 y 1, with y in a type that is RealFloatB, should return the same value as atan y.

Instances2RealFloatB