]      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF 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 01  01. * 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  ,-   portable experimentalekmett@gmail.coma ( transformer that treats ,2 as 34  This lets you use a  ByteString as a 34 source without going through a ,- transformer like UTF8 "a (M transformer that asks only for the values contained in an indexed container %a (A transformer that asks only for the keys of an indexed container (minimal definition * or + -Apply a  directly to the elements of a ( 8  !"#$%&'()*+,-./()*+,%&'"#$ !-./ ! !"#$#$%&'&'()*+,)*+,-./'non-portable (MPTCs, OverloadedStrings) experimentalekmett@gmail.com 0A ,-: 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. 1'We have an unhandled tab to deal with. 2We've only seen part of a line. 3We've seen some carriage returns. 4:An absolute position in a file is known, or an overriding #line directive has been seen 7?Compute the location of the next standard 8-column aligned tab 85lift information about a source file into a starting 0 for that file 9jextract partial information about the current column, even in the absence of knowledge of the source file :Fextract partial information about the current line number if possible ;<extract the standard format for an absolute source position 6 0123456789:; 70432165:98; 04321123456789:;'non-portable (MPTCs, OverloadedStrings) experimentalekmett@gmail.com<A  & transformer that strips out newlines >A  6 transformer that strips out any character matched by ,5 @A   transformer that breaks a 34 ( into distinct lines, feeding a 34  each line in turn. AA   transformer that breaks a 34 ( into distinct words, feeding a 34  each line in turn B#Extract the matched words from the A ,- C#Extract the matched lines from the @ ,- D^Utility function to extract words using accumulator, inside-word, and until-next-word monoids E^Utility function to extract lines using accumulator, inside-line, and until-next-line monoids 4 <=>?@ABCDE AB>?D@C<=E <==>??@ABCDE portable experimentalekmett@gmail.com* FGHFGHFGHGH portable experimentalekmett@gmail.comAn LZ78 compressing (, which supports efficient * operations Ja type-constrained - operation Kcontruct an LZ78-compressed ( using a 67* internally, requires an instance of Ord. Lcontruct an LZ78-compressed (6 using a list internally, requires an instance of Eq. M*QuickCheck property: decode . encode = id N,QuickCheck property: decode . encodeEq = id >  !"#$%&'()*+,-./IJKLMNIJKLMNIJKLMN (non-portable (overloaded strings, MPTCs) experimentalekmett@gmail.com* OPQOPQOPQPQ #non-portable (type families, MPTCs) experimentalekmett@gmail.comRA generalization of Data.List.cycle to an arbitrary ,-9. May fail to terminate for some values in some monoids. SA generalization of Data.List.repeat to an arbitrary ,-9. May fail to terminate for some values in some monoids. TA 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 RSTUSTRURSTU portable experimentalekmett@gmail.comVA ( which supports efficient ** operations over run-length encoded data. Y#A single run with a strict length. \<naive left to right encoder, which can handle infinite data ]*QuickCheck property: decode . encode = id B  !"#$%&'()*+,-./VWXYZ[\]^_ VWXYZ[^\_] VWXWXYZZ[\]^_portable experimentalekmett@gmail.com`A ,- is just a ,8. with one object. This fakes that with a GADT aThe ,-7 of the endomorphisms over some object in an arbitrary ,8. d Extract the ,- from its representation as a ,8 eConvert a value in a ,- into an arrow in a ,8. 2     `abcdeabc`de`abcbcdeportable experimentalekmett@gmail.comfgfgfgportable experimentalekmett@gmail.comfghhh"portable (but instances use MPTCs) experimentalekmett@gmail.comi Convert a ,- into a o . Mnemonic: Exp a * Exp b = Exp (a + b) l Convert a o into a ,- . Mnemonic: Log a + Log b = Log (a * b) 'fgijklmnopq opqlmnijk ijkjklmnmnopqpqportable experimentalekmett@gmail.com)fghijklmnopqrrrportable (instances use MPTCs) experimentalekmett@gmail.coms (a + b) * c = (a * c) + (b * c)t a * (b + c) = (a * b) + (a * c))fgijklmnopqsttsstnon-portable (MPTCs) experimentalekmett@gmail.comuA u is an instance of both o and ,- where  q distributes over f. *fgijklmnopqstuuuvThe ,- ( ,9,,.) over ,. a where ,. is the top element yThe ,- (,9,,.) over ,. a where ,. is the bottom element |The ,- given by ( ,9,,:) The ,- (,9,,:) vwxyz{|}~|}~yz{vwxvwxwxyz{z{|}~}~ experimentalekmett@gmail.comA u which adds ,: and ,: to a pre-existing type. A u using a type's built-in Bounded instance. 1fgijklmnopqstuThe u ( ,9,,:) 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 0fgijklmnopqstu;portable experimentalekmett@gmail.com+fghijklmnopqrstportable experimentalEdward Kmett <ekmett@gmail.com>Minimal complete definition:  or  "fgportable experimentalekmett@gmail.com$fgportable experimentalekmett@gmail.com"Minimal definition over or grecip x / y x  y/fgijklmnopqportable experimentalekmett@gmail.com&fghportable experimentalekmett@gmail.com7fghijklmnopqrportable (instances use MPTCs) experimentalekmett@gmail.com/fgijklmnopqstunon-portable (MPTCs) experimentalekmett@gmail.com2fgijklmnopqstunon-portable (MPTCs) experimentalekmett@gmail.com2fgijklmnopqstu ?non-portable (MPTCs, scoped types, empty decls, type operators) experimentalEdward Kmett <ekmett@gmail.com>4fgijklmnopqstu!non-portable (MPTCs) experimentalekmett@gmail.com  (x *. m) .* y = x *. (m .* y)  (m .* x) * y = m .* (x * y)  (x * y) *. m = x * (y *. m)4fgijklmnopqstu"non-portable (MPTCs) experimentalekmett@gmail.comif m is a ! over r and f is a ,< then f "" m is a ! over r as well A "" turns any ,< instance into a ,-.  It also provides a o instance for an ,< functor wrapped around a ,-  and asserts that any ,< applied to a ,- forms a s  under these operations. A "" uses an glues together ,< 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 I fgijklmnopqstu #non-portable (MPTCs) experimentalekmett@gmail.comif m is a ! over r and f is a ,= then f ## m is a ! as well A ## turns any ,= instance into a ,-.  It also provides a o instance for a ,= wrapped around a ,-  and asserts that any ,= applied to a ,- forms a s  under these operations. An ## uses glues together ,= actions with (>>)  in the manner of ,= 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 > fgijklmnopqst $#non-portable (type families, MPTCs) experimentalekmett@gmail.com Efficiently * a ( using the ""4 monoid. A specialized version of its namesake from  Data.Foldable   * " !Convenience function as found in  Data.Foldable   ,: $ 1The sum of a collection of actions, generalizing ,>   / "  Efficiently * a ( 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   ,: $ 1The sum of a collection of actions, generalizing ,>   / #  Efficiently * a ( using the G F 4 monoid. A specialized version of its namesake from  Data.Foldable   . H  Type specialization of foldMap above  Efficiently - a ( using the G F 4 monoid. A specialized version of its namesake from  Data.Foldable   / H   Convert any (. to a list of its contents. Specialization of -  Efficiently - a ( that contains values of type 3?   / ,-  Efficiently - a ( that contains values of type 3?   / ,-  Efficiently * any (C checking to see if any of its values match the supplied predicate   . ,-  Efficiently * any (C checking to see if all of its values match the supplied predicate   . ,- (Efficiently sum over the members of any (   / ,- 2Efficiently take the product of every member of a (   / ,- Check to see if $ member of the ( matches the supplied value BCheck to make sure that the supplied value is not a member of the (  Efficiently * a subset of the elements in a ( 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  !"#$%&'()*+,-./%non-portable (MPTCs) experimentalekmett@gmail.com:  !"#$%&'()*+,-./&#non-portable (type families, MPTCs) experimentalekmett@gmail.com,fgijklmnopqstu' *r *. (x * y) = (r *. x) * y = x * (r *. y) *(x * y) .* r = y * (x .* r) = (y .* r) * x5fgijklmnopqstu(portable (instances use MPTCs) experimentalekmett@gmail.com7fgijklmnopqstu)portable experimentalekmett@gmail.com4fgijklmnopqstu*:fgijklmnopqstu@ABCDEFGHIJKLMNOPPQRRSTUVWWXYZ[\\]^^_``abcdefghijklmnopqrstuvwxymz{|}~             !!!!!""""""""""##########$$$$$$$$$$$$$$$$$$$$$%%&&'((()*,-,.,/,-,-,-,-,-,-,-,- ,- ,- ,- ,- ,- ,- ,- ,-,-,-,-,-,-,-,-,-,-,-,-0101,34, 67,8,8 ,8!,8",8#,$%,.&,$',(),(*,+,<,,<-,./,=0,=,.1,233?45monoids-0.1.25Data.Monoid.ReducerData.Monoid.Reducer.Char Data.Monoid.Lexical.UTF8.DecoderData.Monoid.Reducer.WithData.Monoid.UnionData.Generator"Data.Monoid.Lexical.SourcePositionData.Monoid.Lexical.WordsData.Monoid.SelfData.Generator.Compressive.LZ78Data.Monoid.FromStringData.Monoid.CombinatorsData.Generator.Compressive.RLEData.Monoid.CategoricalData.Monoid.AdditiveData.Monoid.Additive.SugarData.Monoid.Multiplicative Data.Monoid.Multiplicative.SugarData.Ring.Semi.NearData.Ring.SemiData.Monoid.OrdData.Ring.Semi.OrdData.Ring.Semi.Tropical Data.GroupData.Group.CombinatorsData.Group.MultiplicativeData.Group.SugarData.Group.Multiplicative.Sugar Data.RingData.Ring.BooleanData.Ring.FromNumData.Ring.ModularArithmeticData.Ring.ModuleData.Monoid.ApplicativeData.Monoid.MonadData.Generator.CombinatorsData.Generator.FreeData.Ring.Semi.NaturalData.Ring.Algebra)Data.Ring.Module.AutomaticDifferentiation Data.FieldData.Field.VectorSpaceData.Monoid.Instancesbase Data.Monoid Data.Maybe Data.Foldablefingertree-0.0Data.FingerTree Data.Wordghc-prim GHC.Types Data.Charcontainers-0.2.0.1Data.MapControl.CategoryData.OrdPreludeData.Ring.SugarControl.Applicative Control.Monad Data.ListGHC.Bool ReducedBy Reduction getReductionReducerunitsnoccons foldMapReduce foldReduce returnUnitpureUnit CharReducerfromChar invalidCharUTF8runUTF8 WithReducerwithoutReducer UnionWith getUnionWith HasUnionWith unionWith emptyWithUniongetUnionHasUnionemptyunionChar8getChar8Values getValuesKeysgetKeys GeneratorElem mapReducemapTomapFromreduce mapReduceWith reduceWithSourcePositionTabColumnsLinesPos SourceColumn SourceLinenextTab startOfFile sourceColumn sourceLineshowSourcePositionUnlined runUnlinedUnspaced runUnspacedWordsrunWordsrunLines wordsFrom linesFromSelfgetSelfLZ78decodeencodeencodeEqprop_decode_encodeprop_decode_encodeEq FromString getFromStringcyclerepeat replicate!prop_replicate_right_distributiveRLEgetRLERun encodeListprop_decode_encodeListCMonoidGEndogetGEndocategoryToMonoidmonoidToCategorypluszero+ExpgetExpLoggetLogMultiplicativeonetimes*RightSemiNearRingLeftSemiNearRingSemiRing MinPrioritygetMinPriority MaxPrioritygetMaxPriorityMingetMinMaxgetMax minfinityinfinityPriorityMaxBoundMinBoundOrdergetOrderTropical getTropicalGroupgnegateminus gsubtractMultiplicativeGroupoverundergrecip-negatesubtract/\\recipRingBoolRing getBoolRingFromNum getFromNumModularmodulusModgetModwithIntegralModulusModule RightModule.* LeftModule*.AppgetAppAltgetAlt Traversal getTraversal snocTraversalMongetMonMonadSum getMonadSumAction getAction snocAction traverse_for_asummapM_forM_msumfoldMap concatMapfoldtoListandoranyallsumproductelemnotElemfilter filterWithfindFree AnyGeneratorNaturalnaturalAlgebraDliftdField VectorSpaceMonoidMaybeFoldablemappendmconcatmemptygetDualDualappEndoEndogetAllAllgetAnyAnygetSumSum getProductProductgetFirstFirstgetLastLast FingerTreemeasureGHC.WordWord8Char GHC.UnicodeisSpaceTokenMapCategory>>><<<.id GHC.ClassesminNothingmaxGHC.EnummaxBoundminBoundGHC.Num Applicative AlternativeGHC.BaseMonad MonadPlusflipGHC.ListconcatBool