Copyright | (c) 2016 Andrew Lelechenko |
---|---|
License | MIT |
Maintainer | Andrew Lelechenko <andrew.lelechenko@gmail.com> |
Stability | Provisional |
Portability | Non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
An abstract type class for unique factorisation domains.
Synopsis
- type family Prime (f :: *) :: *
- class UniqueFactorisation a where
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 # | |
Defined in Math.NumberTheory.Primes.Types | |
type Prime Integer Source # | |
Defined in Math.NumberTheory.Primes.Types | |
type Prime Natural Source # | |
Defined in Math.NumberTheory.Primes.Types | |
type Prime Word Source # | |
Defined in Math.NumberTheory.Primes.Types | |
type Prime GaussianInteger Source # | |
Defined in Math.NumberTheory.UniqueFactorisation | |
type Prime EisensteinInteger Source # | |
Defined in Math.NumberTheory.UniqueFactorisation | |
type Prime (Prefactored a) Source # | |
Defined in Math.NumberTheory.Prefactored |
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.
unPrime :: Prime a -> a Source #
factorise :: a -> [(Prime a, Word)] Source #
Instances
UniqueFactorisation Int Source # | |
UniqueFactorisation Integer Source # | |
UniqueFactorisation Natural Source # | |
UniqueFactorisation Word Source # | |
UniqueFactorisation GaussianInteger Source # | |
Defined in Math.NumberTheory.UniqueFactorisation unPrime :: Prime GaussianInteger -> GaussianInteger Source # factorise :: GaussianInteger -> [(Prime GaussianInteger, Word)] Source # isPrime :: GaussianInteger -> Maybe (Prime GaussianInteger) Source # | |
UniqueFactorisation EisensteinInteger Source # | |
Defined in Math.NumberTheory.UniqueFactorisation | |
(Eq a, Num a, UniqueFactorisation a) => UniqueFactorisation (Prefactored a) Source # | |
Defined in Math.NumberTheory.Prefactored unPrime :: Prime (Prefactored a) -> Prefactored a Source # factorise :: Prefactored a -> [(Prime (Prefactored a), Word)] Source # isPrime :: Prefactored a -> Maybe (Prime (Prefactored a)) Source # |