HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulenumeric-prelude-0.4.4Haskell98

Algebra.Units

  • 1 class
  • 8 values

Class

5 declarations
classclass C a => C a where
#

This class lets us deal with the units in a ring. isUnit tells whether an element is a unit. The other operations let us canonically write an element as a unit times another element. Two elements a, b of a ring R are _associates_ if a=b*u for a unit u. For an element a, we want to write it as a=b*u where b is an associate of a. The map (a->b) is called StandardAssociate by Gap, "unitCanonical" by Axiom, and "canAssoc" by DoCon. The map (a->u) is called "canInv" by DoCon and "unitNormal(x).unit" by Axiom.

The laws are

  stdAssociate x * stdUnit x === x
    stdUnit x * stdUnitInv x === 1
 isUnit u ==> stdAssociate x === stdAssociate (x*u)

Currently some algorithms assume

 stdAssociate(x*y) === stdAssociate x * stdAssociate y

Minimal definition: isUnit and (stdUnit or stdUnitInv) and optionally stdAssociate

Instances11C, …
  • C IntegerDefined in numeric-prelude-0.4.4 · Algebra.Units
  • C Int16Defined in numeric-prelude-0.4.4 · Algebra.Units
  • C Int32Defined in numeric-prelude-0.4.4 · Algebra.Units
  • C Int64Defined in numeric-prelude-0.4.4 · Algebra.Units
  • C Int8Defined in numeric-prelude-0.4.4 · Algebra.Units
  • C IntDefined in numeric-prelude-0.4.4 · Algebra.Units
  • 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 · MathObj.Wrapper.NumericPrelude
  • (Ord a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · Number.Complex
  • (C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · MathObj.Polynomial

Standard implementations for instances

4 declarations

Properties

4 declarations