#      !"#$%&'()*+ , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _`abcdefghijklmnopqrstuvwxyz{|}~ !!!""""""""""""""""#######$$$$%%%%%&&portable experimentalekmett@gmail.comnon-portable (MPTCs) experimentalekmett@gmail.com$This type may be best read infix. A c  m is a '( m that maps  values of type c through unit to values of type m. A c- may also ) supply operations which tack-on another c to an existing '( m on the left P or right. These specialized reductions may be more efficient in some scenarios $ and are used when appropriate by a  Generator . The names  and  work = by analogy to the synonymous operations in the list monoid. LThis class deliberately avoids functional-dependencies, so that () can be a c -Reducer  for all cJ, and so many common reducers can work over multiple types, for instance,  First and Last may reduce both a and ') a . Since a  Generator has a fixed element Z type, the input to the reducer is generally known and extracting from the monoid usually Z is sufficient to fix the result type. Combinators are available for most scenarios where X this is not the case, and the few remaining cases can be handled by using an explicit  type annotation. Minimal definition:  or  Convert a value into a '( Append a value to a '($ for use in left-to-right reduction Prepend a value onto a '(( for use during right-to-left reduction Apply a  to a '*K container, after mapping the contents into a suitable form for reduction. Apply a  to a '* mapping each element through  '      !"    non-portable (MPTCs) experimentalekmett@gmail.com "Provides a mechanism for the UTF8 '(6 to report invalid characters to one or more monoids. *      !"    non-portable (MPTCs) experimentalekmett@gmail.com,      !" non-portable (MPTCs) experimentalekmett@gmail.comIf m is a c-Reducer , then m is (c  m)-Reducer ( This can be used to quickly select a Reducer for use as a #+,  $+,. *      !" The '( ('unionWith mappend',)! for containers full of monoids. MPolymorphic containers that we can supply an operation to handle unions with The '( (,) A Container suitable for the  '( 3      !"   #non-portable (type families, MPTCs) experimentalekmett@gmail.comA generalization of Data.List.cycle to an arbitrary '(9. May fail to terminate for some values in some monoids. A generalization of Data.List.repeat to an arbitrary '(9. May fail to terminate for some values in some monoids. !A generalization of Data.List.replicate to an arbitrary '(. Adapted from   Jhttp://augustss.blogspot.com/2008/07/lost-and-found-if-i-write-108-in.html  !" !" !"portable experimentalekmett@gmail.com#A '( is just a %'-. with one object. This fakes that with a GADT $The '(7 of the endomorphisms over some object in an arbitrary %'-. ' Extract the '( from its representation as a %'- (Convert a value in a '( into an arrow in a %'-. 2      !"&'()% #$%&'($%&#'(#$%&%&'(portable experimentalekmett@gmail.com      !")*)*)* portable experimentalekmett@gmail.com+a 4  transformer that treats *'. as +/0  This lets you use a  ByteString as a +/0 source without going through a '( transformer like UTF8 .a 4 M transformer that asks only for the values contained in an indexed container 1a 4 A transformer that asks only for the keys of an indexed container 4minimal definition 6  or 7  9Apply a  directly to the elements of a 4  8      !" +,-./0123456789:;45678123./0+,-9:;+,-,-./0/0123234567856789:; portable experimentalekmett@gmail.com<A 4  which supports efficient 6 * operations over run-length encoded data. ?#A single run with a strict length. B<naive left to right encoder, which can handle infinite data C*QuickCheck property: decode . encode = id B      !" +,-./0123456789:;<=>?@ABCDE <=>?@ADBEC <=>=>?@@ABCDE 'non-portable (MPTCs, OverloadedStrings) experimentalekmett@gmail.com FA '(: of partial information about locations in a source file. _ This is polymorphic in the kind of information you want to maintain about each source file. G'We have an unhandled tab to deal with. HWe've only seen part of a line. IWe've seen some carriage returns. J:An absolute position in a file is known, or an overriding #line directive has been seen M?Compute the location of the next standard 8-column aligned tab N5lift information about a source file into a starting F  for that file Ojextract partial information about the current column, even in the absence of knowledge of the source file PFextract partial information about the current line number if possible Q<extract the standard format for an absolute source position 6      !" FGHIJKLMNOPQ MFJIHGLKPONQ FJIHGGHIJKLMNOPQ 'non-portable (MPTCs, OverloadedStrings) experimentalekmett@gmail.comRA  & transformer that strips out newlines TA  6 transformer that strips out any character matched by ,'1 VA   transformer that breaks a +/0 4  into distinct lines, feeding a +/0  each line in turn. WA   transformer that breaks a +/0 4  into distinct words, feeding a +/0  each line in turn X#Extract the matched words from the W  '( Y#Extract the matched lines from the V  '( Z^Utility function to extract words using accumulator, inside-word, and until-next-word monoids [^Utility function to extract lines using accumulator, inside-line, and until-next-line monoids 4      !" RSTUVWXYZ[ WXTUZVYRS[ RSSTUUVWXYZ[ portable experimentalekmett@gmail.com*      !" \]^\]^\]^]^portable experimentalekmett@gmail.com-An LZ78 compressing 4 , which supports efficient 6  operations `a type-constrained 9  operation acontruct an LZ78-compressed 4  using a .23* internally, requires an instance of Ord. bcontruct an LZ78-compressed 4 6 using a list internally, requires an instance of Eq. c*QuickCheck property: decode . encode = id d,QuickCheck property: decode . encodeEq = id >      !" +,-./0123456789:;_`abcd_`abcd_`abcd(non-portable (overloaded strings, MPTCs) experimentalekmett@gmail.com*      !" efgefgefgfg"portable (but instances use MPTCs) experimentalekmett@gmail.comh Convert a '( into a n . Mnemonic: Exp a * Exp b = Exp (a + b) k Convert a n into a '( . Mnemonic: Log a + Log b = Log (a * b) '      !")*hijklmnop nopklmhij hijijklmlmnopopportable experimentalEdward Kmett <ekmett@gmail.com>q"Minimal definition over or grecip r x / ys x  yuMinimal complete definition: v or w /      !")*hijklmnopqrstuvwxuvwxqrstqrstrstuvwxvwxportable experimentalekmett@gmail.com1      !")*hijklmnopqrstuvwxyzyzyzportable (instances use MPTCs) experimentalekmett@gmail.com~A ~ is an instance of both n and '( where  p distributes over ).  (a + b) * c = (a * c) + (b * c) a * (b + c) = (a * b) + (a * c)0 annihilates p 6      !")*hijklmnopqrstuvwx{|}~~}|{{|}~The '( (/'4,0')) over ') a where 0') is the top element The '( (1'4,0')) over ') a where 0') is the bottom element The '( given by (/'4,2'5) The '( (1'4,3'5)  non-portable (MPTCs) experimentalekmett@gmail.com9      !")*hijklmnopqrstuvwx{|}~non-portable (MPTCs) experimentalekmett@gmail.com#Algebra over a (near) (semi) ring.  *r *. (x * y) = (r *. x) * y = x * (r *. y)  *(x * y) .* r = y * (x .* r) = (y .* r) * x  An r-normed module m satisfies:    mabs m >= 02 'mabs m == zero{-_r-} => m == zero{-_m-} 3  mabs (m + n) <= mabs m + mabs n 4 5r * mabs m = mabs (r *. m) -- if m is an r-LeftModule 5 6mabs m * r = mabs (m .* r) -- if m is an r-RightModule  (x *. m) .* y = x *. (m .* y)  (m .* x) * y = m .* (x * y)  (x * y) *. m = x * (y *. m)@      !")*hijklmnopqrstuvwx{|}~ non-portable (MPTCs) experimentalekmett@gmail.comif m is a  over r and f is a 4'6 then f  m is a  over r as well A  turns any 5'6 instance into a '(.  It also provides a n instance for an 4'6 functor wrapped around a '(  and asserts that any 5'6 applied to a '( forms a   under these operations. A  uses an glues together 4'6 actions with (*>)  in the manner of  traverse_ from  Data.Foldable. Any values returned by " reduced actions are discarded. 2Efficiently avoid needlessly rebinding when using & on an action that already returns () ; A rewrite rule automatically applies this when possible U      !" )*hijklmnopqrstuvwx{|}~ non-portable (MPTCs) experimentalekmett@gmail.comif m is a  over r and f is a 6'7 then f  m is a  as well A  turns any 7'7 instance into a '(.  It also provides a n instance for a 6'7 wrapped around a '(  and asserts that any 7'7 applied to a '( forms a   under these operations. An  uses glues together 6'7 actions with (>>)  in the manner of 8'7 from  Data.Foldable. Any values returned by " reduced actions are discarded. 2Efficiently avoid needlessly rebinding when using & on an action that already returns () ; A rewrite rule automatically applies this when possible U      !" )*hijklmnopqrstuvwx{|}~ #non-portable (type families, MPTCs) experimentalekmett@gmail.com Efficiently 6  a 4  using the 4 monoid. A specialized version of its namesake from  Data.Foldable   6   !Convenience function as found in  Data.Foldable   9'5  1The sum of a collection of actions, generalizing :'8   ;    Efficiently 6  a 4  using the 4 monoid. A specialized version of its namesake from  Data.Foldable and  Control.Monad   :   !Convenience function as found in  Data.Foldable and  Control.Monad   9'5  1The sum of a collection of actions, generalizing :'8   ;    Efficiently 6  a 4  using the ] \ 4 monoid. A specialized version of its namesake from  Data.Foldable   :  ^  Type specialization of foldMap above  Efficiently 9  a 4  using the ] \ 4 monoid. A specialized version of its namesake from  Data.Foldable   ;  ^   Convert any 4 . to a list of its contents. Specialization of 9   Efficiently 9  a 4  that contains values of type ;/9   ;  '(  Efficiently 9  a 4  that contains values of type ;/9   ;  '(  Efficiently 6  any 4 C checking to see if any of its values match the supplied predicate   :  '(  Efficiently 6  any 4 C checking to see if all of its values match the supplied predicate   :  '( (Efficiently sum over the members of any 4    ;  '( 2Efficiently take the product of every member of a 4    ;  '( Check to see if  member of the 4  matches the supplied value BCheck to make sure that the supplied value is not a member of the 4   Efficiently 6  a subset of the elements in a 4  jAllows idiomatic specialization of filter by proving a function that will be used to transform the output A specialization of  using the '('( '(, analogous to Data.List.find    '( M      !" +,-./0123456789:;non-portable (MPTCs) experimentalekmett@gmail.com:      !" +,-./0123456789:;portable (instances use MPTCs) experimentalekmett@gmail.comC      !")*hijklmnopqrstuvwx{|}~8      !")*hijklmnopqrstuvwx{|}~>      !")*hijklmnopqrstuvwx{|}~#non-portable (type families, MPTCs) experimentalekmett@gmail.com9      !")*hijklmnopqrstuvwx{|}~portable experimentalekmett@gmail.com<      !")*hijklmnopqrstuvwx{|}~ portable experimentalekmett@gmail.comC      !")*hijklmnopqrstuvwx{|}~!non-portable (MPTCs) experimentalekmett@gmail.com9      !")*hijklmnopqrstuvwx{|}~"portable (instances use MPTCs) experimentalekmett@gmail.com!vSet operations optimized for tightly grouped sets or nearly universal sets with a close by group of elements missing. w Stores itself like an arbitrary precision floating point number, tracking the least valued member of the set and an & Integer comprised of the members. <1A conservative upper bound on the element count. A If negative, we are complemented with respect to the universe =1A conservative lower bound on the element count. A If negative, we are complemented with respect to the universe >KLazy element count used when the above two disagree. O(1) environment size ?CLow water mark. index of the least element potentially in the set. @GHigh water mark. index of the greatest element potentially in the set. A,the set of bits starting from the exponent. C if negative, then we are complmenented with respect to universe Binvariant: whenever mantissa <5 0, universe = (fromEnum minBound,fromEnum maxBound) C5self-contained extraction behavior, enables Foldable DEInternal smart constructor. Forces count whenever it is pigeonholed. EO(d) where d> is absolute deviation in the output of fromEnum over the set O(1) The empty set. Permits O(1) null and size. O(1) Construct a BitSet with a single element. Permits O(1) null and size O(1) amortized cost. Is the "' empty? May be faster than checking if " == 0. O(1)8 amortized cost. The number of elements in the bit set. O(d) A "/ containing every member of the enumeration of a. FO(d)\ unsafe internal method: complement a set that has already been complemented at least once. GO(d)\ unsafe internal method: complement a set that has already been complemented at least once. O(d * n) Make a " from a list of items. O(d * n) Make a ") from a distinct ascending list of items O(d)! Insert a single element of type a into the ". Preserves order of " and " O(d) Delete a single item from the ". Preserves order of " and " O(1) Test for membership in a " O(d)B convert to an Integer representation. Discards negative elements O(d). O(1)6 Check to see if we are represented as a complemented ". O(d) HSUnsafe internal method for computing differences in a known universe of discourse. Preconditions:  m >= 0  2 m' >= 0  3 a /= -1  4 a' /= -1  5 b /= 0  6 b' /= 0  7 u''" is a previously obtained copy of &(fromEnum minBound, fromEnum maxBound) IO(d)A Remove all elements present in the second bitset from the first O(d) Infix I J8Utility function to avoid requiring ScopedTypeVariables KO(d) LO(d)O. Computes the equivalent of (truncate . logBase 2 . abs) extended with 0 at 0 R      !"M )*hijklmnopqrstuvwx{|}~# experimentalekmett@gmail.comA ~ which adds 3'5 and 2'5 to a pre-existing type. A ~ using a type's built-in Bounded instance. =      !")*hijklmnopqrstuvwx{|}~$The ~ (/'4,N'5) over a extended with $.  When aH has a Num instance with an addition that respects order, then this is S transformed into a tropical semiring. It is assumed that 0 is the least element  of a.  Ahttp://hal.archives-ouvertes.fr/docs/00/11/37/79/PDF/Tropical.pdf E      !" )*hijklmnopqrstuvwx{|}~%?non-portable (MPTCs, scoped types, empty decls, type operators) experimentalEdward Kmett <ekmett@gmail.com>;      !")*hijklmnopqrstuvwx{|}~O:;<=>?@ABCDEFGHIJJKLLMNOPQQRSTUVWXYZ[[\]^_` a a b c c d e e f g h i j k l m n o o p q q r s t u v w x y z { | } ~    z    ruvXYT !!!""T"""""""""""U""" # # # # # # #$$$$%%%%%'(')'*'('('('('('('('('('( '(!'(!'("'(#'(#'($'(%'(%'(&'(''(''(('()'()'(*'(+'(++,,+,-'-.'-/'-0'-1'-2'34/05'678239':;')<':='>?'>@'6A'6B'CD'7E'7'CF'GH/9I"J"K"L"M"N"O"P"Q"R""S"T"U"V"W"X"Y'Z['\]monoids-0.1.36Data.Monoid.ReducerData.Monoid.Reducer.Char Data.Monoid.Lexical.UTF8.DecoderData.Monoid.Reducer.WithData.Monoid.UnionData.Monoid.CombinatorsData.Monoid.CategoricalData.Monoid.AdditiveData.GeneratorData.Generator.Compressive.RLE"Data.Monoid.Lexical.SourcePositionData.Monoid.Lexical.WordsData.Monoid.SelfData.Generator.Compressive.LZ78Data.Monoid.FromStringData.Monoid.Multiplicative Data.GroupData.Group.Combinators Data.RingData.Monoid.OrdData.Ring.FromNumData.Ring.ModuleData.Monoid.ApplicativeData.Monoid.MonadData.Generator.CombinatorsData.Generator.Free)Data.Ring.Module.AutomaticDifferentiationData.Ring.Semi.KleeneData.Ring.Semi.Near.TrieData.Ring.Semi.NaturalData.Monoid.SugarData.Group.SugarData.Ring.BooleanData.Ring.Semi.BitSetData.Ring.Semi.OrdData.Ring.Semi.TropicalData.Ring.ModularArithmeticData.Monoid.Instancesbase Data.Monoid Data.Maybe Data.Foldablefingertree-0.0Data.FingerTreeControl.Category Data.Wordghc-prim GHC.Types Data.Charcontainers-0.2.0.1Data.MapData.OrdPreludeControl.Applicative Control.Monad Data.ListGHC.Bool ReducedBy Reduction getReductionReducerunitsnoccons foldMapReduce foldReduce returnUnitpureUnit CharReducerfromChar invalidCharUTF8runUTF8 WithReducerwithoutReducer UnionWith getUnionWith HasUnionWith unionWith emptyWithUniongetUnionHasUnionemptyunioncyclerepeat replicate!prop_replicate_right_distributiveCMonoidGEndogetGEndocategoryToMonoidmonoidToCategorypluszeroChar8getChar8Values getValuesKeysgetKeys GeneratorElem mapReducemapTomapFromreduce mapReduceWith reduceWithRLEgetRLERundecode encodeListprop_decode_encodeListencodeprop_decode_encodeSourcePositionTabColumnsLinesPos SourceColumn SourceLinenextTab startOfFile sourceColumn sourceLineshowSourcePositionUnlined runUnlinedUnspaced runUnspacedWordsrunWordsrunLines wordsFrom linesFromSelfgetSelfLZ78encodeEqprop_decode_encodeEq FromString getFromStringExpgetExpLoggetLogMultiplicativeonetimesMultiplicativeGroupoverundergrecipGroupgnegateminus gsubtractField DivisionRingRingSemiRingRightSemiNearRingLeftSemiNearRingRingoid MinPrioritygetMinPriority MaxPrioritygetMaxPriorityMingetMinMaxgetMax minfinityinfinityFromNum getFromNumAlgebraNormedmabs VectorSpaceBimodule RightModule.* LeftModule*.ModuleAppgetAppAltgetAlt Traversal getTraversal snocTraversalMongetMonMonadSum getMonadSumAction getAction snocAction traverse_for_asummapM_forM_msumfoldMap concatMapfoldtoListandoranyallsumproductelemnotElemfilter filterWithfindFree AnyGeneratorDliftd KleeneAlgebrastarTrietotallabelchildren singletonnullNatural toNatural fromNatural+*^-negatesubtract/.\.recip^^Boolean getBooleanBitSetsizefullfromListfromDistinctAscListinsertdeletemember toIntegerisComplemented intersection\\PriorityMaxBoundMinBoundOrdergetOrderTropical getTropicalModularmodulusModgetModwithIntegralModulusMonoidMaybeFoldablemappendmconcatmemptygetDualDualappEndoEndogetAllAllgetAnyAnygetSumSum getProductProductgetFirstFirstgetLastLast FingerTreemeasureCategory>>><<<.idGHC.WordWord8Char GHC.UnicodeisSpaceTokenMap GHC.ClassesminNothingmaxGHC.EnummaxBoundminBound Applicative AlternativeGHC.BaseMonad MonadPlusflipGHC.ListconcatBool _countAtLeast _countAtMost_countexponent_hwmmantissa _universe _fromEnumbs recomplementpseudoComplementdiff difference asArgTypeOfrecounthwm Data.Bits complementGHC.Num