arithmoi-0.8.0.0: Efficient basic number-theoretic functions.

Copyright(c) 2016 Andrew Lelechenko
LicenseMIT
MaintainerAndrew Lelechenko <andrew.lelechenko@gmail.com>
StabilityProvisional
PortabilityNon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Math.NumberTheory.UniqueFactorisation

Description

An abstract type class for unique factorisation domains.

Synopsis

Documentation

type family Prime (f :: *) :: * Source #

Type of primes of a given unique factorisation domain.

abs (unPrime n) == unPrime n must hold for all n of type Prime t

Instances
type Prime Int Source # 
Instance details

Defined in Math.NumberTheory.Primes.Types

type Prime Int
type Prime Integer Source # 
Instance details

Defined in Math.NumberTheory.Primes.Types

type Prime Natural Source # 
Instance details

Defined in Math.NumberTheory.Primes.Types

type Prime Word Source # 
Instance details

Defined in Math.NumberTheory.Primes.Types

type Prime Word
type Prime GaussianInteger Source # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

type Prime EisensteinInteger Source # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

type Prime (Prefactored a) Source # 
Instance details

Defined in Math.NumberTheory.Prefactored

type Prime (Prefactored a) = Prime a

class UniqueFactorisation a where Source #

The following invariant must hold for n /= 0:

abs n == abs (product (map (\(p, k) -> unPrime p ^ k) (factorise n)))

The result of factorise should not contain zero powers and should not change after multiplication of the argument by domain's unit.

Minimal complete definition

unPrime, factorise

Methods

unPrime :: Prime a -> a Source #

factorise :: a -> [(Prime a, Word)] Source #

isPrime :: a -> Maybe (Prime a) Source #

isPrime :: (Eq a, Num a) => a -> Maybe (Prime a) Source #

Instances
UniqueFactorisation Int Source # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

UniqueFactorisation Integer Source # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

UniqueFactorisation Natural Source # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

UniqueFactorisation Word Source # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

UniqueFactorisation GaussianInteger Source # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

UniqueFactorisation EisensteinInteger Source # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

(Eq a, Num a, UniqueFactorisation a) => UniqueFactorisation (Prefactored a) Source # 
Instance details

Defined in Math.NumberTheory.Prefactored