Safe Haskell | None |
---|---|
Language | Haskell98 |
- (+), (-) :: C a => a -> a -> a
- (+), (-) :: C a => a -> a -> a
- negate :: C a => a -> a
- zero :: C a => a
- subtract :: C a => a -> a -> a
- sum :: C a => [a] -> a
- sum1 :: C a => [a] -> a
- isZero :: C a => a -> Bool
- (*) :: C a => a -> a -> a
- one :: C a => a
- fromInteger :: C a => Integer -> a
- (^) :: C a => a -> Integer -> a
- ringPower :: (C a, C b) => b -> a -> a
- sqr :: C a => a -> a
- product :: C a => [a] -> a
- product1 :: C a => [a] -> a
- div, mod :: C a => a -> a -> a
- div, mod :: C a => a -> a -> a
- divMod :: C a => a -> a -> (a, a)
- divides :: (C a, C a) => a -> a -> Bool
- even :: (C a, C a) => a -> Bool
- odd :: (C a, C a) => a -> Bool
- (/) :: C a => a -> a -> a
- recip :: C a => a -> a
- fromRational' :: C a => Rational -> a
- (^-) :: C a => a -> Integer -> a
- fieldPower :: (C a, C b) => b -> a -> a
- fromRational :: C a => Rational -> a
- (^/) :: C a => a -> Rational -> a
- sqrt :: C a => a -> a
- pi :: C a => a
- exp, log :: C a => a -> a
- exp, log :: C a => a -> a
- logBase, (**) :: C a => a -> a -> a
- logBase, (**) :: C a => a -> a -> a
- (^?) :: C a => a -> a -> a
- sin, cos, tan :: C a => a -> a
- sin, cos, tan :: C a => a -> a
- sin, cos, tan :: C a => a -> a
- asin, acos, atan :: C a => a -> a
- asin, acos, atan :: C a => a -> a
- asin, acos, atan :: C a => a -> a
- sinh, cosh, tanh :: C a => a -> a
- sinh, cosh, tanh :: C a => a -> a
- sinh, cosh, tanh :: C a => a -> a
- asinh, acosh, atanh :: C a => a -> a
- asinh, acosh, atanh :: C a => a -> a
- asinh, acosh, atanh :: C a => a -> a
- abs :: C a => a -> a
- signum :: C a => a -> a
- quot, rem :: C a => a -> a -> a
- quot, rem :: C a => a -> a -> a
- quotRem :: C a => a -> a -> (a, a)
- splitFraction :: (C a, C b) => a -> (b, a)
- fraction :: C a => a -> a
- truncate :: (C a, C b) => a -> b
- round :: (C a, C b) => a -> b
- ceiling, floor :: (C a, C b) => a -> b
- ceiling, floor :: (C a, C b) => a -> b
- approxRational :: (C a, C a) => a -> a -> Rational
- atan2 :: C a => a -> a -> a
- toRational :: C a => a -> Rational
- toInteger :: C a => a -> Integer
- fromIntegral :: (C a, C b) => a -> b
- isUnit :: C a => a -> Bool
- stdAssociate, stdUnit, stdUnitInv :: C a => a -> a
- stdAssociate, stdUnit, stdUnitInv :: C a => a -> a
- stdAssociate, stdUnit, stdUnitInv :: C a => a -> a
- extendedGCD :: C a => a -> a -> (a, (a, a))
- gcd :: C a => a -> a -> a
- lcm :: C a => a -> a -> a
- euclid :: (C a, C a) => (a -> a -> a) -> a -> a -> a
- extendedEuclid :: (C a, C a) => (a -> a -> (a, a)) -> a -> a -> (a, (a, a))
- type Rational = T Integer
- (%) :: C a => a -> a -> T a
- numerator :: T a -> a
- denominator :: T a -> a
- data Integer :: *
- data Int :: *
- data Float :: *
- data Double :: *
- (*>) :: C a v => a -> v -> v
Documentation
subtract :: C a => a -> a -> a Source #
subtract
is (-)
with swapped operand order.
This is the operand order which will be needed in most cases
of partial application.
sum :: C a => [a] -> a Source #
Sum up all elements of a list. An empty list yields zero.
This function is inappropriate for number types like Peano.
Maybe we should make sum
a method of Additive.
This would also make lengthLeft
and lengthRight
superfluous.
sum1 :: C a => [a] -> a Source #
Sum up all elements of a non-empty list. This avoids including a zero which is useful for types where no universal zero is available. ToDo: Should have NonEmpty type.
fromInteger :: C a => Integer -> a Source #
(^) :: C a => a -> Integer -> a infixr 8 Source #
The exponent has fixed type Integer
in order
to avoid an arbitrarily limitted range of exponents,
but to reduce the need for the compiler to guess the type (default type).
In practice the exponent is most oftenly fixed, and is most oftenly 2
.
Fixed exponents can be optimized away and
thus the expensive computation of Integer
s doesn't matter.
The previous solution used a C
constrained type
and the exponent was converted to Integer before computation.
So the current solution is not less efficient.
A variant of ^
with more flexibility is provided by ringPower
.
ringPower :: (C a, C b) => b -> a -> a Source #
A prefix function of '(Algebra.Ring.^)' with a parameter order that fits the needs of partial application and function composition. It has generalised exponent.
See: Argument order of expNat
on
http://www.haskell.org/pipermail/haskell-cafe/2006-September/018022.html
fromRational' :: C a => Rational -> a Source #
fieldPower :: (C a, C b) => b -> a -> a Source #
A prefix function of '(Algebra.Field.^-)'. It has a generalised exponent.
fromRational :: C a => Rational -> a Source #
Needed to work around shortcomings in GHC.
splitFraction :: (C a, C b) => a -> (b, a) Source #
approxRational :: (C a, C a) => a -> a -> Rational Source #
TODO: Should be moved to a continued fraction module.
toRational :: C a => a -> Rational Source #
Lossless conversion from any representation of a rational to Rational
fromIntegral :: (C a, C b) => a -> b Source #
stdAssociate, stdUnit, stdUnitInv :: C a => a -> a Source #
stdAssociate, stdUnit, stdUnitInv :: C a => a -> a Source #
stdAssociate, stdUnit, stdUnitInv :: C a => a -> a Source #
extendedGCD :: C a => a -> a -> (a, (a, a)) Source #
Compute the greatest common divisor and solve a respective Diophantine equation.
(g,(a,b)) = extendedGCD x y ==> g==a*x+b*y && g == gcd x y
TODO: This method is not appropriate for the PID class, because there are rings like the one of the multivariate polynomials, where for all x and y greatest common divisors of x and y exist, but they cannot be represented as a linear combination of x and y. TODO: The definition of extendedGCD does not return the canonical associate.
gcd :: C a => a -> a -> a Source #
The Greatest Common Divisor is defined by:
gcd x y == gcd y x divides z x && divides z y ==> divides z (gcd x y) (specification) divides (gcd x y) x
extendedEuclid :: (C a, C a) => (a -> a -> (a, a)) -> a -> a -> (a, (a, a)) Source #
denominator :: T a -> a Source #
Invariant: Jn#
and Jp#
are used iff value doesn't fit in S#
Useful properties resulting from the invariants:
Enum Integer | Since: 2.1 |
Eq Integer | |
Integral Integer | Since: 2.0.1 |
Num Integer | Since: 2.1 |
Ord Integer | |
Read Integer | Since: 2.1 |
Real Integer | Since: 2.0.1 |
Show Integer | Since: 2.1 |
Ix Integer | Since: 2.1 |
Lift Integer | |
Arbitrary Integer | |
CoArbitrary Integer | |
NFData Integer | |
Random Integer | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Source # | |
C Integer Integer Source # | |
C Integer Integer Source # | |
C Integer Integer Source # | |
C Integer Integer Source # | |
C Integer Integer Source # | |
Sqr Integer Integer Source # | |
C a => C Integer (T a) Source # | |
A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]
.
The exact range for a given implementation can be determined by using
minBound
and maxBound
from the Bounded
class.
Bounded Int | Since: 2.1 |
Enum Int | Since: 2.1 |
Eq Int | |
Integral Int | Since: 2.0.1 |
Num Int | Since: 2.1 |
Ord Int | |
Read Int | Since: 2.1 |
Real Int | Since: 2.0.1 |
Show Int | Since: 2.1 |
Ix Int | Since: 2.1 |
Lift Int | |
Arbitrary Int | |
CoArbitrary Int | |
Storable Int | Since: 2.1 |
NFData Int | |
Random Int | |
C Int Source # | |
C Int Source # | |
C Int Source # | |
C Int Source # | |
C Int Source # | |
C Int Source # | |
C Int Source # | |
C Int Source # | |
C Int Source # | |
C Int Source # | |
C Int Source # | |
C Int Int Source # | |
C Int Int Source # | |
C Int Int Source # | |
C Int Int Source # | |
C Int Int Source # | |
Sqr Int Int Source # | |
Generic1 k (URec k Int) | |
Functor (URec * Int) | |
Foldable (URec * Int) | |
Traversable (URec * Int) | |
Eq (URec k Int p) | |
Ord (URec k Int p) | |
Show (URec k Int p) | |
Generic (URec k Int p) | |
data URec k Int | Used for marking occurrences of Since: 4.9.0.0 |
type Rep1 k (URec k Int) | |
type Rep (URec k Int p) | |
Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.
Eq Float | |
Floating Float | Since: 2.1 |
Ord Float | |
Read Float | Since: 2.1 |
RealFloat Float | Since: 2.1 |
Lift Float | |
Arbitrary Float | |
CoArbitrary Float | |
Storable Float | Since: 2.1 |
NFData Float | |
Random Float | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
C Float Source # | |
Power Float Source # | |
C Float Float Source # | |
C Float Float Source # | |
C Float Float Source # | |
C Float Float Source # | |
C Float Float Source # | |
C Float Float Source # | |
C Float Float Source # | |
Sqr Float Float Source # | |
Generic1 k (URec k Float) | |
Functor (URec * Float) | |
Foldable (URec * Float) | |
Traversable (URec * Float) | |
Eq (URec k Float p) | |
Ord (URec k Float p) | |
Show (URec k Float p) | |
Generic (URec k Float p) | |
data URec k Float | Used for marking occurrences of Since: 4.9.0.0 |
type Rep1 k (URec k Float) | |
type Rep (URec k Float p) | |
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
Eq Double | |
Floating Double | Since: 2.1 |
Ord Double | |
Read Double | Since: 2.1 |
RealFloat Double | Since: 2.1 |
Lift Double | |
Arbitrary Double | |
CoArbitrary Double | |
Storable Double | Since: 2.1 |
NFData Double | |
Random Double | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
C Double Source # | |
Power Double Source # | |
C Double Double Source # | |
C Double Double Source # | |
C Double Double Source # | |
C Double Double Source # | |
C Double Double Source # | |
C Double Double Source # | |
C Double Double Source # | |
Sqr Double Double Source # | |
Generic1 k (URec k Double) | |
Functor (URec * Double) | |
Foldable (URec * Double) | |
Traversable (URec * Double) | |
Eq (URec k Double p) | |
Ord (URec k Double p) | |
Show (URec k Double p) | |
Generic (URec k Double p) | |
data URec k Double | Used for marking occurrences of Since: 4.9.0.0 |
type Rep1 k (URec k Double) | |
type Rep (URec k Double p) | |