0)      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                  ! " # $ % & ' ( Safe@ CAn Abelian Group is associative, unital, invertible and commutative-A Group is associative, unital and invertibleA Loop is unital and invertible9A CMonoidal Magma is commutative, associative and unital.+A Monoidal Magma is associative and unital.An Idempotent Magma  a " a = aAn Invertible Magma " a " T: inv a " T&law is true by construction in HaskellA Commutative Magma  a " b = b " a An Associative Magma (a " b) " c = a " (b " c) A Unital Magma unit " a = a a " unit = a A  -https://en.wikipedia.org/wiki/Magma_(algebra)Magma is a tuple (T,") consisting of a type a, anda function (") :: T -> T -> T&The mathematical laws for a magma are:2" is defined for all possible pairs of type T, and7" is closed in the set of all possible values of type Tor, more tersly, " a, b " T: a " b " TFThese laws are true by construction in haskell: the type signature of magma. and the above mathematical laws are synonyms.see 8http://chris-taylor.github.io/blog/2013/02/25/xor-trick/       Safe@ Minus () is reserved for where both the left and right cancellative laws hold. This then implies that the AdditiveGroup is also Abelian.Syntactic unary negation - substituting "negate a" for "-a" in code - is hard-coded in the language to assume a Num instance. So, for example, using ''-a = zero - a' for the second rule below doesn't work. Ha - a = zero negate a = zero - a negate a + a = zero a + negate a = zeroNon-commutative right minus a `plus` negate a = zeroNon-commutative left minus negate a `plus` a = zero>Additive is commutative, unital and associative under addition Ezero + a == a a + zero == a (a + b) + c == a + (b + c) a + b == b + aIdempotent magma for addition. a `plus` a == aInvertible magma for addition. " a " A: negate a " A&law is true by construction in HaskellCommutative magma for addition. a `plus` b == b `plus` aAssociative magma for addition. .(a `plus` b) `plus` c == a `plus` (b `plus` c)Unital magma for addition. %zero `plus` a == a a `plus` zero == aD is used as the operator for the additive magma to distinguish from , which, by convention, implies commutativity " a,b " A: a `plus` b " A&law is true by construction in Haskell ;sum definition avoiding a clash with the Sum monoid in base< !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ  5 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ6666Safe@ KDivide (L) is reserved for where both the left and right cancellative laws hold. This then implies that the MultiplicativeGroup is also Abelian. Aa / a = one recip a = one / a recip a * a = one a * recip a = oneMNon-commutative right divide a `times` recip a = oneONon-commutative left divide recip a `times` a = oneQJMultiplicative is commutative, associative and unital under multiplication Cone * a == a a * one == a (a * b) * c == a * (b * c) a * b == b * a)$Idempotent magma for multiplication. a `times` a == aS$Invertible magma for multiplication. " a " A: recip a " A&law is true by construction in HaskellU%Commutative magma for multiplication. a `times` b == b `times` aV%Associative magma for multiplication. 2(a `times` b) `times` c == a `times` (b `times` c)W Unital magma for multiplication. %one `times` a == a a `times` one == aYZJ is used as the operator for the multiplicative magam to distinguish from R, which, by convention, implies commutativity " a,b " A: a `times` b " A&law is true by construction in Haskell[Cproduct definition avoiding a clash with the Product monoid in base7KLMNOPQR)STUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~KLMNOPQRSTUVWXYZ[YZWXVUST[QRMNOPKL0KLMNOPQR)STUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~L7N7P7R7None9;<=@element by element division a ./. a == singleton one!element by element multiplication e(a .*. b) .*. c == a .*. (b .*. c) singleton one .*. a = a a .*. singelton one = a a .*. b == b .*. aelement by element subtraction a .-. a = singleton zeroelement by element addition S(a .+. b) .+. c == a .+. (b .+. c) zero .+. a = a a .+. zero = a a .+. b == b .+. a 7767Safe@$Distribution (and annihilation) laws [a * (b + c) == a * b + a * c (a + b) * c == a * c + b * c a * zero == zero zero * a == zeroSafe@ICRing is a Ring with Multiplicative Commutation. It arises often due to R9 being defined as a multiplicative commutative operation.ARing a summary of the laws inherited from the ring super-classes szero + a == a a + zero == a (a + b) + c == a + (b + c) a + b == b + a a - a = zero negate a = zero - a negate a + a = zero a + negate a = zero one `times` a == a a `times` one == a (a `times` b) `times` c == a `times` (b `times` c) a `times` (b + c) == a `times` b + a `times` c (a + b) `times` c == a `times` c + b `times` c a `times` zero == zero zero `times` a == zeroSemiringSafe@ Trigonometric Field`A bounded field includes the concepts of infinity and NaN, thus moving away from error throwing. one / zero + infinity == infinity infinity + a == infinity isNaN (infinity - infinity) isNaN (infinity / infinity) isNaN (nan + a) zero / zero != nan}Note the tricky law that, although nan is assigned to zero/zero, they are never-the-less not equal. A committee decided this.Pquotient fields explode constraints if they allow for polymorphic integral types Ra - one < floor a <= a <= ceiling a < a + one round a == floor (a + one/(one+one))A hyperbolic field class Ysqrt . (**2) == identity log . exp == identity for +ive b, a != 0,1: a ** logBase a b "H bTA Field is a Ring plus additive invertible and multiplicative invertible operations.<A summary of the rules inherited from super-classes of Field pzero + a == a a + zero == a (a + b) + c == a + (b + c) a + b == b + a a - a = zero negate a = zero - a negate a + a = zero a + negate a = zero one * a == a a * one == a (a * b) * c == a * (b * c) a * (b + c) == a * b + a * c (a + b) * c == a * c + b * c a * zero == zero zero * a == zero a * b == b * a a / a = one recip a = one / a recip a * a = one a * recip a = one:A Semifield is a Field without Commutative Multiplication. prints as Infinity prints as  `-Infinity`Otodo: work out boundings for complex as it stands now, complex is different eg $one / (zero :: Complex Float) == nan!todo: bottom is here somewhere???3##Safe9;<=@ftodo: This should probably be split off into some sort of alternative Equality logic, but to what end?distance between numbers distance a b >= zero distance a a == zero \a b c -> distance a c + distance b c - distance a b >= zero && distance a b + distance b c - distance a c >= zero && distance a b + distance a c - distance b c >= zero &&@Like Signed, except the codomain can be different to the domain.signumz from base is not an operator replicated in numhask, being such a very silly name, and preferred is the much more obvious . Compare with Norm and Banach$ where there is a change in codomain abs a * sign a == aGeneralising this class tends towards size and direction (abs is the size on the one-dim number line of a vector with its tail at zero, and sign is the direction, right?).-todo: is utf perfectly acceptable these days?!4 Safe@+fromInteger is the most problematic of the Num class operators. Particularly heinous, it is assumed that any number type can be constructed from an Integer, so that the broad classes of objects that are composed of multiple elements is avoided in haskell.KtoInteger is kept separate from Integral to help with compatability issues. Integral laws /b == zero || b * (a `div` b) + (a `mod` b) == a coercion of s fromIntegral a == a        77 None +9;<=@DQR  generalised outer product 3a><b + c><b == (a+c) >< b a><b + a><c == a >< (b+c)6todo: work out why these laws down't apply > a *. (b> c)== (a<b) .* c > (a> b).* c == a *. (b<c)*representation synthesistensorial type4the inner product of a representable over a semiring ba <.> b == b <.> a a <.> (b +c) == a <.> b + a <.> c a <.> (s *. b + c) == s * (a <.> b) + a <.> c (s0 *. a)  . (s1 *. b) == s0 * s1 * (a  . b)zBanach (with Norm) laws form rules around size and direction of a number, with a potential crossing into another codomain. 1a == singleton zero || normalize a *. size a == aDivision Module Laws ?nearZero a || a ./ one == a b == zero || a ./ b == recip b *. aMultiplicative Module Laws xa .* one == a (a + b) .* c == (a .* c) + (b .* c) c *. (a + b) == (c *. a) + (c *. b) a .* zero == zero a .* b == b *. aSubtraction Module Laws `(a + b) .- c == a + (b .- c) (a + b) .- c == (a .- c) + b a .- zero == a a .- b == negate b +. aAdditive Module Laws Y(a + b) .+ c == a + (b .+ c) (a + b) .+ c == (a .+ c) + b a .+ zero == a a .+ b == b +. a" synonym for ( .)  * !"#$%&'(   !" !"    * !"#$%&'(  888777766 6!6+    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                             ! " # $ % & ' ( ) * + , - . / 0 1 23 45'plankton-0.0.0.1-1cj9ffRl2QjCBjECFQezCqPlankton.MagmaPlankton.AdditivePlankton.MultiplicativePlankton.BasisPlankton.Distribution Plankton.RingPlankton.FieldPlankton.MetricPlankton.IntegralPlankton.ModuleAbelianGroupLoop CMonoidalMonoidal Idempotent Invertibleinv Commutative AssociativeUnitalunitMagma⊕ groupSwap AdditiveGroup-AdditiveRightCancellative-~AdditiveLeftCancellative~-Additive+AdditiveIdempotentAdditiveInvertiblenegateAdditiveCommutativeAdditiveAssociativeAdditiveUnitalzero AdditiveMagmaplussum$fAdditiveGroupComplex$fAdditiveGroupInteger$fAdditiveGroupInt$fAdditiveGroupFloat$fAdditiveGroupDouble$fAdditiveComplex$fAdditiveBool$fAdditiveInteger $fAdditiveInt$fAdditiveFloat$fAdditiveDouble$fAdditiveIdempotentBool$fAdditiveInvertibleComplex$fAdditiveInvertibleBool$fAdditiveInvertibleInteger$fAdditiveInvertibleInt$fAdditiveInvertibleFloat$fAdditiveInvertibleDouble$fAdditiveCommutativeComplex$fAdditiveCommutativeBool$fAdditiveCommutativeInteger$fAdditiveCommutativeInt$fAdditiveCommutativeFloat$fAdditiveCommutativeDouble$fAdditiveAssociativeComplex$fAdditiveAssociativeBool$fAdditiveAssociativeInteger$fAdditiveAssociativeInt$fAdditiveAssociativeFloat$fAdditiveAssociativeDouble$fAdditiveUnitalComplex$fAdditiveUnitalBool$fAdditiveUnitalInteger$fAdditiveUnitalInt$fAdditiveUnitalFloat$fAdditiveUnitalDouble$fAdditiveMagmaComplex$fAdditiveMagmaBool$fAdditiveMagmaInteger$fAdditiveMagmaInt$fAdditiveMagmaFloat$fAdditiveMagmaDoubleMultiplicativeGroup/MultiplicativeRightCancellative/~MultiplicativeLeftCancellative~/Multiplicative*MultiplicativeInvertiblerecipMultiplicativeCommutativeMultiplicativeAssociativeMultiplicativeUnitaloneMultiplicativeMagmatimesproduct$fMultiplicativeGroupComplex$fMultiplicativeGroupFloat$fMultiplicativeGroupDouble$fMultiplicativeComplex$fMultiplicativeBool$fMultiplicativeInteger$fMultiplicativeInt$fMultiplicativeFloat$fMultiplicativeDouble$fMultiplicativeIdempotentBool!$fMultiplicativeInvertibleComplex$fMultiplicativeInvertibleFloat $fMultiplicativeInvertibleDouble"$fMultiplicativeCommutativeComplex$fMultiplicativeCommutativeBool"$fMultiplicativeCommutativeInteger$fMultiplicativeCommutativeInt $fMultiplicativeCommutativeFloat!$fMultiplicativeCommutativeDouble"$fMultiplicativeAssociativeComplex$fMultiplicativeAssociativeBool"$fMultiplicativeAssociativeInteger$fMultiplicativeAssociativeInt $fMultiplicativeAssociativeFloat!$fMultiplicativeAssociativeDouble$fMultiplicativeUnitalComplex$fMultiplicativeUnitalBool$fMultiplicativeUnitalInteger$fMultiplicativeUnitalInt$fMultiplicativeUnitalFloat$fMultiplicativeUnitalDouble$fMultiplicativeMagmaComplex$fMultiplicativeMagmaBool$fMultiplicativeMagmaInteger$fMultiplicativeMagmaInt$fMultiplicativeMagmaFloat$fMultiplicativeMagmaDoubleMultiplicativeGroupBasis./.MultiplicativeBasis.*.AdditiveGroupBasis.-. AdditiveBasis.+.$fMultiplicativeGroupBasisra$fMultiplicativeBasisra$fAdditiveGroupBasisra$fAdditiveBasisra Distribution$fDistributionComplex$fDistributionBool$fDistributionInteger$fDistributionInt$fDistributionFloat$fDistributionDoubleCRingRingSemiring$fCRingComplex$fCRingInteger $fCRingInt $fCRingFloat $fCRingDouble $fRingComplex $fRingInteger $fRingInt $fRingFloat $fRingDouble$fSemiringComplex$fSemiringBool$fSemiringInteger $fSemiringInt$fSemiringFloat$fSemiringDouble TrigFieldpisincostanasinacosatansinhcoshtanhasinhacoshatanhatan2 BoundedFieldmaxBoundminBoundnanisNaN QuotientFieldroundceilingfloor^^ExpFieldexploglogBase**sqrtField Semifieldinfinity neginfinity$fTrigFieldFloat$fTrigFieldDouble$fBoundedFieldComplex$fBoundedFieldDouble$fBoundedFieldFloat$fQuotientFieldDouble$fQuotientFieldFloat$fExpFieldComplex$fExpFieldFloat$fExpFieldDouble$fFieldComplex $fFieldFloat $fFieldDouble$fSemifieldComplex$fSemifieldFloat$fSemifieldDoubleEpsilonnearZero aboutEqualpositive veryPositive veryNegativeMetricdistanceNormedsizeSignedsignabs≈$fEpsilonComplex$fEpsilonInteger $fEpsilonInt$fEpsilonFloat$fEpsilonDouble$fMetricComplexa$fMetricIntegerInteger$fMetricIntInt$fMetricFloatFloat$fMetricDoubleDouble$fNormedComplexa$fNormedIntegerInteger$fNormedIntInt$fNormedFloatFloat$fNormedDoubleDouble$fSignedInteger $fSignedInt $fSignedFloat$fSignedDouble FromInteger fromInteger ToInteger toIntegerIntegraldivmoddivMod fromIntegral$fToIntegerInteger$fToIntegerInt$fFromIntegerInteger$fFromIntegerInt$fFromIntegerFloat$fFromIntegerDouble$fIntegralInteger $fIntegralInt TensorProduct><outer timesleft timesrightHilbert<.>Banach normalizeMultiplicativeGroupModule.//.MultiplicativeModule.**.AdditiveGroupModule.--.AdditiveModule.++.inner$fTensorProductr $fBanachra$fMultiplicativeGroupModulera$fMultiplicativeModulera$fAdditiveGroupModulera$fAdditiveModuleraMultiplicativeIdempotent TensorRep