Copyright | (c) 2015-2018 Frederick Schneider |
---|---|
License | MIT |
Maintainer | Frederick Schneider <frederick.schneider2011@gmail.com> |
Stability | Provisional |
Safe Haskell | None |
Language | Haskell2010 |
This a wrapper for the Canonical Representation type found in the Internals module. If you want to work with arbitrarily nested prime towers, you can use the Math.NumberTheory.Canon module.
- newtype SimpleCanon = MakeSC CR_
- type SC = SimpleCanon
- toSimpleCanon :: CanonConv a => a -> SimpleCanon
- toSC :: CanonConv c => c -> SimpleCanon
- toSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> SimpleCanon
- fromSimpleCanon :: SimpleCanon -> CR_
- fromSC :: SimpleCanon -> CR_
- class CanonConv c where
- scGCD :: SimpleCanon -> SimpleCanon -> SimpleCanon
- scLCM :: SimpleCanon -> SimpleCanon -> SimpleCanon
- scLog :: SimpleCanon -> Rational
- scLogDouble :: SimpleCanon -> Double
- scNegative :: SimpleCanon -> Bool
- scPositive :: SimpleCanon -> Bool
- scToInteger :: SimpleCanon -> Integer
- scToI :: SimpleCanon -> Integer
- newtype RationalSimpleCanon = MakeRC CR_
- type RC = RationalSimpleCanon
- toRationalSimpleCanon :: CanonConv a => a -> RationalSimpleCanon
- toRC :: CanonConv c => c -> RationalSimpleCanon
- toRationalSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> RationalSimpleCanon
- fromRationalSimpleCanon :: RationalSimpleCanon -> CR_
- fromRC :: RationalSimpleCanon -> CR_
- rcNegative :: RationalSimpleCanon -> Bool
- rcPositive :: RationalSimpleCanon -> Bool
- getNumer :: RationalSimpleCanon -> SimpleCanon
- getDenom :: RationalSimpleCanon -> SimpleCanon
- getNumerDenom :: RationalSimpleCanon -> (SimpleCanon, SimpleCanon)
- getNumerAsRC :: RationalSimpleCanon -> RationalSimpleCanon
- getDenomAsRC :: RationalSimpleCanon -> RationalSimpleCanon
- getNumerDenomAsRCs :: RationalSimpleCanon -> (RationalSimpleCanon, RationalSimpleCanon)
- rcLog :: RationalSimpleCanon -> Rational
- rcLogDouble :: RationalSimpleCanon -> Double
- (>^) :: SimpleCanonRoot a b c => a -> b -> c
- (<^) :: SimpleCanonExpnt a b c => a -> b -> c
- (%) :: Integral a => a -> a -> a
Documentation
newtype SimpleCanon Source #
SimpleCanon is a new type wrapping a canonical representation.
Enum SimpleCanon Source # | |
Eq SimpleCanon Source # | |
Fractional SimpleCanon Source # | |
Integral SimpleCanon Source # | |
Num SimpleCanon Source # | |
Ord SimpleCanon Source # | |
Real SimpleCanon Source # | |
Show SimpleCanon Source # | Define various instances |
CanonConv SimpleCanon Source # | |
type SC = SimpleCanon Source #
Shorthand type declaration
toSimpleCanon :: CanonConv a => a -> SimpleCanon Source #
Convert CanonConv types to SimpleCanon.
toSC :: CanonConv c => c -> SimpleCanon Source #
Convert a type to a SimpleCanon.
toSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> SimpleCanon Source #
This function allow you to specify a user function when converting a canon rep to an SC.
fromSimpleCanon :: SimpleCanon -> CR_ Source #
Grab the canon rep from a SimpleCanon.
fromSC :: SimpleCanon -> CR_ Source #
Grab the canon rep from a SimpleCanon.
class CanonConv c where Source #
Typeclass for converting to SimpleCanon and RationalSimpleCanon
toSC :: c -> SimpleCanon Source #
Convert a type to a SimpleCanon.
toRC :: c -> RationalSimpleCanon Source #
Convert a type to a RationalSimpleCanon.
scGCD :: SimpleCanon -> SimpleCanon -> SimpleCanon Source #
SimpleCanon GCD and LCM functions
scLCM :: SimpleCanon -> SimpleCanon -> SimpleCanon Source #
SimpleCanon GCD and LCM functions
scLog :: SimpleCanon -> Rational Source #
Wrapper for underlying CR function
scLogDouble :: SimpleCanon -> Double Source #
Wrapper for underlying CR function
scNegative :: SimpleCanon -> Bool Source #
Wrappers for underlying canon rep functions
scPositive :: SimpleCanon -> Bool Source #
Wrappers for underlying canon rep functions
scToInteger :: SimpleCanon -> Integer Source #
Convert a SimpleCanon back to an Integer.
scToI :: SimpleCanon -> Integer Source #
Convert a SimpleCanon back to an Integer.
newtype RationalSimpleCanon Source #
Newtype for RationalSimpleCanon. The underlying canon rep is the same.
Enum RationalSimpleCanon Source # | |
Eq RationalSimpleCanon Source # | |
Fractional RationalSimpleCanon Source # | |
Integral RationalSimpleCanon Source # | Caveat: These functions will error out (in)directly if there are any negative exponents. |
Num RationalSimpleCanon Source # | |
Ord RationalSimpleCanon Source # | |
Real RationalSimpleCanon Source # | |
Show RationalSimpleCanon Source # | Define various instances for RationSimpleCanon. |
CanonConv RationalSimpleCanon Source # | |
type RC = RationalSimpleCanon Source #
Shorthand type name
toRationalSimpleCanon :: CanonConv a => a -> RationalSimpleCanon Source #
Convert CanonConv types to RationalSimpleCanon.
toRC :: CanonConv c => c -> RationalSimpleCanon Source #
Convert a type to a RationalSimpleCanon.
toRationalSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> RationalSimpleCanon Source #
Convert canon rep to RationalSimpleCanon via a user-supplied criterion function.
fromRationalSimpleCanon :: RationalSimpleCanon -> CR_ Source #
Convert RC back to underlying canon rep.
fromRC :: RationalSimpleCanon -> CR_ Source #
Convert RC back to underlying canon rep.
rcNegative :: RationalSimpleCanon -> Bool Source #
Wraps underlying canon rep functions.
rcPositive :: RationalSimpleCanon -> Bool Source #
Wraps underlying canon rep functions.
getNumer :: RationalSimpleCanon -> SimpleCanon Source #
Pulls numerator or denominator from RC and converts it to a SimpleCanon.
getDenom :: RationalSimpleCanon -> SimpleCanon Source #
Pulls numerator or denominator from RC and converts it to a SimpleCanon.
getNumerDenom :: RationalSimpleCanon -> (SimpleCanon, SimpleCanon) Source #
Wraps crSplit function and returns a pair of SimpleCanons.
getNumerAsRC :: RationalSimpleCanon -> RationalSimpleCanon Source #
Calls underlying canon rep function.
getDenomAsRC :: RationalSimpleCanon -> RationalSimpleCanon Source #
Calls underlying canon rep function.
getNumerDenomAsRCs :: RationalSimpleCanon -> (RationalSimpleCanon, RationalSimpleCanon) Source #
Wraps crSplit function and returns a pair of RationalSimpleCanons.
rcLog :: RationalSimpleCanon -> Rational Source #
Calls underlying canon rep function.
rcLogDouble :: RationalSimpleCanon -> Double Source #
Calls underlying canon rep function.