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.
- 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
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.