>v      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~NoneNone23456T[3  (  Haskell semiringsMITmail@doisinkidney.com experimentalNone /23456IThe " .https://ncatlab.org/nlab/show/max-plus+algebraArctic0" or max-plus semiring. It is a semiring where: % =  " = -" $ = % # = "Note that we can't use  from   % because annihilation needs to hold: -" % x = x % -" = -"Taking -" to be " would break the above law. Using " to represent it follows the law.The " /https://ncatlab.org/nlab/show/tropical+semiringTropical0" or min-plus semiring. It is a semiring where: % =  " = " $ = % # = "Note that we can't use   from   % because annihilation needs to hold: " % x = x % " = "Taking " to be " would break the above law. Using " to represent it follows the law. Monoid under $. Analogous to   , but uses the ! constraint, rather than . Monoid under %. Analogous to  , but uses the ! constraint, rather than .A  5https://en.wikipedia.org/wiki/Semiring#Star_semirings Star semiring adds one operation,  to a ! , such that it follows the law:  x = # % x $  x = # %  x $ xNFor the semiring of types, this is equivalent to a list. When looking at the  and ; classes as (near-) semirings, this is equivalent to the  operation.Another operation,   , can be defined in relation to :   x = x $  xBThis should be recognizable as a non-empty list on types, or the  operation in .!A  &https://en.wikipedia.org/wiki/SemiringSemiring% is like the the combination of two  s. The first is called %; it has the identity element "/, and it is commutative. The second is called $; it has identity element #, and it must distribute over %.LawsNormal   laws (a % b) % c = a % (b % c) " % a = a % " = a (a $ b) $ c = a $ (b $ c) # $ a = a $ # = aCommutativity of % a % b = b % aDistribution of $ over % a $ (b % c) = (a $ b) % (a $ c) (a % b) $ c = (a $ c) % (b $ c) Annihilation " $ a = a $ " = "%An ordered semiring follows the laws: x   y => x % z   y % z x   y => x % z   y % z "   z   x   y => x $ z   y $ z   z $ x   z $ y"The identity of %.#The identity of $.$8An associative binary operation, which distributes over %.%-An associative, commutative binary operation.&#Takes the sum of the elements of a  . Analogous to   on numbers, or  on s. add [1..5]15add [False, False]Falseadd [False, True]Trueadd [True, undefined]True''Takes the product of the elements of a  . Analogous to  on numbers, or  on s. mul [1..5]120mul [True, True]Truemul [True, False]Falsemul [False, undefined]FalseThis is not a true semiring. In particular, it requires the underlying monoid to be commutative, and even then, it is only a near semiring. It is, however, extremely useful. For instance, this type:  forall a.  ( a)hIs a valid encoding of church numerals, with addition and multiplication being their semiring variants.The (->)& instance is analogous to the one for  .(getMin . foldMap Min) [1..10]1.0(getMax . foldMap Max) [1..10]10.0A polynomial in x: can be defined as a list of its coefficients, where the i!th element is the coefficient of x^i6. This is the semiring for such a list. Adapted from  Nhttps://pdfs.semanticscholar.org/702d/348c32133997e992db362a19697d5607ab32.pdfhere.!Not lawful. Only for convenience.!Not lawful. Only for convenience.!Not lawful. Only for convenience. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ (  !%"$#&'1!"#$%"#%$   &' !"#$%"#%$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ $7%6None234I(AThe free semiring. Adapted from PureScript's version, available  Zhttps://pursuit.purescript.org/packages/purescript-semirings/3.0.0/docs/Data.Semiring.Freehere9. Only a valid semiring if treated as a multiset, as in: Free [[1],[0]] == Free [[0],[1]]True+Run a (.,Run a (-, interpreting it in the underlying semiring..%Extremely slow. For testing purposes. ()*+,-./0()*+,()*+, ()*+,-./09 "Some interesting numeric semiringsMITmail@doisinkidney.com experimentalNone2345I=DUseful for optimizing multiplication, or working with large numbers. ($) = () x % y = -( ( (-x) +  (-y))) " = " # = 0@ ;https://en.wikipedia.org/wiki/Semiring#cite_ref-droste_14-0 Wikipedia& has some information on this. Also  Shttp://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.304.6152&rep=rep1&type=pdfthis3 paper. Apparently used for probabilistic parsing. (%) =  ($) = ($) " = " # = #C ;https://en.wikipedia.org/wiki/Semiring#cite_ref-droste_14-0 Wikipedia& has some information on this. Also  Shttp://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.304.6152&rep=rep1&type=pdfthis paper. (%) =  x $ y =  0 (x  y  1) " = " # = #FPositive numbers only. (%) =  ($) =  " = " # = #I$Useful for some constraint problems. (%) =  ($) =  " =  # = YOnly expects positive numbers&789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[789:;<=>?@ABCDEFGHIJKIJKFGHCDE@AB=>?:;<789789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[(Some QuickCheck properties for SemiringsMITmail@doisinkidney.com experimentalNoneTPlus is associative.Multiplication is associative.Plus is commutative. Multiplication distributes left.!Multiplication distributes right.Additive identity.Multiplicative identity.Annihilation of $ by ".  !"#$  %&&'(()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./01234566789:;<=>?@ABCDDEFFGHHIJJKLLMNNOPPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                     !" # $% $& ' () (* +,-+semiring-num-0.9.0.1-8Qt8CZjRJGeJpWVt8ArYme Data.SemiringData.Semiring.FreeData.Semiring.Numeric Test.SemiringData.Semiring.THData.Semiring.InfiniteData.SemigroupMaxData SemigroupMin Data.MonoidProductSumControl.Applicative AlternativemanysomeMonoidInfiniteNegativeFinitePositivePositiveInfinite PosFinitePositiveInfinityNegativeInfiniteNegativeInfinity NegFiniteHasNegativeInfinitynegativeInfinityisNegativeInfinityHasPositiveInfinitypositiveInfinityisPositiveInfinitygetMaxgetMinMulgetMulAddgetAddDetectableZeroisZero StarSemiringstarplusSemiringzeroone<.><+>addmul$fDetectableZeroFixed$fDetectableZeroComplex$fDetectableZeroRatio$fDetectableZeroNatural$fDetectableZeroCDev$fDetectableZeroCIno$fDetectableZeroCMode$fDetectableZeroCOff$fDetectableZeroCPid$fDetectableZeroCSsize$fDetectableZeroCGid$fDetectableZeroCNlink$fDetectableZeroCUid$fDetectableZeroCCc$fDetectableZeroCSpeed$fDetectableZeroCTcflag$fDetectableZeroCRLim$fDetectableZeroFd$fDetectableZeroWordPtr$fDetectableZeroIntPtr$fDetectableZeroCChar$fDetectableZeroCSChar$fDetectableZeroCUChar$fDetectableZeroCShort$fDetectableZeroCUShort$fDetectableZeroCInt$fDetectableZeroCUInt$fDetectableZeroCLong$fDetectableZeroCULong$fDetectableZeroCLLong$fDetectableZeroCULLong$fDetectableZeroCFloat$fDetectableZeroCDouble$fDetectableZeroCPtrdiff$fDetectableZeroCSize$fDetectableZeroCWchar$fDetectableZeroCSigAtomic$fDetectableZeroCClock$fDetectableZeroCTime$fDetectableZeroCUSeconds$fDetectableZeroCSUSeconds$fDetectableZeroCIntPtr$fDetectableZeroCUIntPtr$fDetectableZeroCIntMax$fDetectableZeroCUIntMax$fDetectableZeroDouble$fDetectableZeroFloat$fDetectableZeroWord64$fDetectableZeroWord32$fDetectableZeroWord16$fDetectableZeroWord8$fDetectableZeroWord$fDetectableZeroInteger$fDetectableZeroInt64$fDetectableZeroInt32$fDetectableZeroInt16$fDetectableZeroInt8$fDetectableZeroInt$fSemiringFixed$fSemiringComplex$fSemiringRatio$fSemiringNatural$fSemiringCDev$fSemiringCIno$fSemiringCMode$fSemiringCOff$fSemiringCPid$fSemiringCSsize$fSemiringCGid$fSemiringCNlink$fSemiringCUid $fSemiringCCc$fSemiringCSpeed$fSemiringCTcflag$fSemiringCRLim $fSemiringFd$fSemiringWordPtr$fSemiringIntPtr$fSemiringCChar$fSemiringCSChar$fSemiringCUChar$fSemiringCShort$fSemiringCUShort$fSemiringCInt$fSemiringCUInt$fSemiringCLong$fSemiringCULong$fSemiringCLLong$fSemiringCULLong$fSemiringCFloat$fSemiringCDouble$fSemiringCPtrdiff$fSemiringCSize$fSemiringCWchar$fSemiringCSigAtomic$fSemiringCClock$fSemiringCTime$fSemiringCUSeconds$fSemiringCSUSeconds$fSemiringCIntPtr$fSemiringCUIntPtr$fSemiringCIntMax$fSemiringCUIntMax$fSemiringDouble$fSemiringFloat$fSemiringWord64$fSemiringWord32$fSemiringWord16$fSemiringWord8$fSemiringWord$fSemiringInteger$fSemiringInt64$fSemiringInt32$fSemiringInt16$fSemiringInt8 $fSemiringInt$fDetectableZeroAll$fDetectableZeroAny$fStarSemiringAll $fSemiringAll$fStarSemiringAny $fSemiringAny$fDetectableZeroEndo$fStarSemiringEndo$fSemiringEndo$fStarSemiring(->)$fSemiring(->)$fDetectableZeroMax$fDetectableZeroMin$fStarSemiringMin$fStarSemiringMax $fSemiringMin $fSemiringMax $fMonoidMin $fMonoidMax$fSemigroupMin$fSemigroupMax $fMonoidMul $fMonoidAdd$fSemigroupMul$fSemigroupAdd$fDetectableZero[] $fSemiring[]$fStarSemiring()$fDetectableZero() $fSemiring()$fDetectableZeroInfinite $fDetectableZeroPositiveInfinite $fDetectableZeroNegativeInfinite$fStarSemiringPositiveInfinite$fSemiringInfinite$fSemiringPositiveInfinite$fSemiringNegativeInfinite$fDetectableZeroBool$fStarSemiringBool$fSemiringBool$fEqAdd$fOrdAdd $fReadAdd $fShowAdd $fBoundedAdd $fGenericAdd $fGeneric1Add$fNumAdd $fEnumAdd $fStorableAdd$fFractionalAdd $fRealAdd $fRealFracAdd $fFunctorAdd $fFoldableAdd$fTraversableAdd $fSemiringAdd$fStarSemiringAdd$fDetectableZeroAdd$fEqMul$fOrdMul $fReadMul $fShowMul $fBoundedMul $fGenericMul $fGeneric1Mul$fNumMul $fEnumMul $fStorableMul$fFractionalMul $fRealMul $fRealFracMul $fFunctorMul $fFoldableMul$fTraversableMul $fSemiringMul$fStarSemiringMul$fDetectableZeroMul$fEqMin$fOrdMin $fReadMin $fShowMin $fBoundedMin $fGenericMin $fGeneric1Min$fNumMin $fEnumMin $fStorableMin$fFractionalMin $fRealMin $fRealFracMin $fFunctorMin $fFoldableMin$fTraversableMin$fEqMax$fOrdMax $fReadMax $fShowMax $fBoundedMax $fGenericMax $fGeneric1Max$fNumMax $fEnumMax $fStorableMax$fFractionalMax $fRealMax $fRealFracMax $fFunctorMax $fFoldableMax$fTraversableMax$fDetectableZeroIdentity$fDetectableZeroSum$fDetectableZeroProduct$fSemiringIdentity $fSemiringSum$fSemiringProduct$fSemiring(,,,,,,,,)$fSemiring(,,,,,,,)$fSemiring(,,,,,,)$fSemiring(,,,,,)$fSemiring(,,,,)$fSemiring(,,,)$fSemiring(,,) $fSemiring(,)$fStarSemiring(,,,,,,,,)$fStarSemiring(,,,,,,,)$fStarSemiring(,,,,,,)$fStarSemiring(,,,,,)$fStarSemiring(,,,,)$fStarSemiring(,,,)$fStarSemiring(,,)$fStarSemiring(,)$fDetectableZero(,,,,,,,,)$fDetectableZero(,,,,,,,)$fDetectableZero(,,,,,,)$fDetectableZero(,,,,,)$fDetectableZero(,,,,)$fDetectableZero(,,,)$fDetectableZero(,,)$fDetectableZero(,)FreegetFreeliftFreeunFree $fOrdFree$fEqFree$fApplicativeFree$fSemiringFree $fShowFree $fReadFree $fFunctorFree$fFoldableFree$fTraversableFree $fMonoidFreePosInt getPosIntPosFrac getPosFracLoggetLogViterbi getViterbi ŁukasiewiczgetŁukasiewiczDivision getDivision Bottleneck getBottleneck$fStarSemiringPosInt$fDetectableZeroPosInt$fSemiringPosInt$fBoundedPosInt$fStarSemiringPosFrac$fDetectableZeroPosFrac$fSemiringPosFrac$fBoundedPosFrac$fDetectableZeroLog $fSemiringLog$fSemiringViterbi$fDetectableZeroŁukasiewicz$fSemiringŁukasiewicz$fSemiringDivision$fDetectableZeroBottleneck$fSemiringBottleneck$fEqBottleneck$fOrdBottleneck$fReadBottleneck$fShowBottleneck$fBoundedBottleneck$fGenericBottleneck$fGeneric1Bottleneck$fNumBottleneck$fEnumBottleneck$fStorableBottleneck$fFractionalBottleneck$fRealBottleneck$fRealFracBottleneck$fFunctorBottleneck$fFoldableBottleneck$fTraversableBottleneck $fEqDivision $fOrdDivision$fReadDivision$fShowDivision$fBoundedDivision$fGenericDivision$fGeneric1Division $fNumDivision$fEnumDivision$fStorableDivision$fFractionalDivision$fRealDivision$fRealFracDivision$fFunctorDivision$fFoldableDivision$fTraversableDivision$fDetectableZeroDivision$fEqŁukasiewicz$fOrdŁukasiewicz$fReadŁukasiewicz$fShowŁukasiewicz$fBoundedŁukasiewicz$fGenericŁukasiewicz$fGeneric1Łukasiewicz$fNumŁukasiewicz$fEnumŁukasiewicz$fStorableŁukasiewicz$fFractionalŁukasiewicz$fRealŁukasiewicz$fRealFracŁukasiewicz$fFunctorŁukasiewicz$fFoldableŁukasiewicz$fTraversableŁukasiewicz $fEqViterbi $fOrdViterbi $fReadViterbi $fShowViterbi$fBoundedViterbi$fGenericViterbi$fGeneric1Viterbi $fNumViterbi $fEnumViterbi$fStorableViterbi$fFractionalViterbi $fRealViterbi$fRealFracViterbi$fFunctorViterbi$fFoldableViterbi$fTraversableViterbi$fDetectableZeroViterbi$fEqLog$fOrdLog $fReadLog $fShowLog $fGenericLog $fGeneric1Log $fFunctorLog $fFoldableLog $fEqPosFrac $fOrdPosFrac $fReadPosFrac $fShowPosFrac$fGenericPosFrac$fGeneric1PosFrac $fNumPosFrac $fEnumPosFrac$fStorablePosFrac$fFractionalPosFrac $fRealPosFrac$fRealFracPosFrac$fFunctorPosFrac$fFoldablePosFrac$fTraversablePosFrac $fEqPosInt $fOrdPosInt $fReadPosInt $fShowPosInt$fGenericPosInt$fGeneric1PosInt $fNumPosInt $fEnumPosInt$fStorablePosInt$fFractionalPosInt $fRealPosInt$fRealFracPosInt$fFunctorPosInt$fFoldablePosInt$fTraversablePosInt plusAssocmulAssocplusComm mulDistribL mulDistribRplusIdmulId annihilate unaryLaws nearUnaryLawsnearTernaryLaws binaryLaws ternaryLawsstarLawplusLawstarLawsordLawszeroLaw zeroIsZerozeroLawsrepNappNcmbNstarIns semiringInszeroInsandAll CoerceBinary maxBoundOfstrip stripFPtrstripPtr$fStorableInfinite$fStorablePositiveInfinite$fStorableNegativeInfinite $fNumInfinite$fNumPositiveInfinite$fNumNegativeInfinite$fMonoidInfinite$fMonoidPositiveInfinite$fMonoidNegativeInfinite$fEnumInfinite$fEnumPositiveInfinite$fEnumNegativeInfinite$fHasPositiveInfinityInfinite$fHasNegativeInfinityInfinite%$fHasPositiveInfinityPositiveInfinite%$fHasNegativeInfinityNegativeInfinite$fBoundedInfinite$fBoundedPositiveInfinite$fBoundedNegativeInfinite$fApplicativeInfinite$fApplicativePositiveInfinite$fApplicativeNegativeInfinite$fHasNegativeInfinityCFloat$fHasPositiveInfinityCFloat$fHasNegativeInfinityCDouble$fHasPositiveInfinityCDouble$fHasNegativeInfinityFloat$fHasPositiveInfinityFloat$fHasNegativeInfinityDouble$fHasPositiveInfinityDoubleghc-prim GHC.ClassesmaxbaseGHC.EnumminBoundGHC.BaseNothingminmaxBoundGHC.NumNum Applicative<=&& Data.FoldableFoldablesumor GHC.TypesBoolproductandEndo WrapBinary.# isAnagram+ GHC.Floatlogexp-GHC.Realgcdlcm ordAddLaw ordMulLaw