!"#$%&'()*+,-./0123456789:;<=>?@ABC D E F G H I J K L M N O P Q R S T U V WXYZ[\]^_`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.com If 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  &'   portable experimentalekmett@gmail.coma % transformer that treats &, as -.  This lets you use a  ByteString as a -. 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 % 5 !"#$%&'()*+,%&'()"#$ !*+, ! !"#$#$%&'()&'()*+,'non-portable (MPTCs, OverloadedStrings) experimentalekmett@gmail.com -A &': 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. .'We have an unhandled tab to deal with. /We've only seen part of a line. 0We've seen some carriage returns. 1:An absolute position in a file is known, or an overriding #line directive has been seen 4?Compute the location of the next standard 8-column aligned tab 55lift information about a source file into a starting - for that file 6jextract partial information about the current column, even in the absence of knowledge of the source file 7Fextract partial information about the current line number if possible 8<extract the standard format for an absolute source position 3 -./012345678 4-10/.327658 -10/../012345678'non-portable (MPTCs, OverloadedStrings) experimentalekmett@gmail.com9A & transformer that strips out newlines ;A 6 transformer that strips out any character matched by &/ =A  transformer that breaks a -. % into distinct lines, feeding a -.  each line in turn. >A  transformer that breaks a -. % into distinct words, feeding a -.  each line in turn ?#Extract the matched words from the > &' @#Extract the matched lines from the = &' A^Utility function to extract words using accumulator, inside-word, and until-next-word monoids B^Utility function to extract lines using accumulator, inside-line, and until-next-line monoids 1 9:;<=>?@AB >?;<A=@9:B 9::;<<=>?@AB portable experimentalekmett@gmail.com'CDECDECDEDE portable experimentalekmett@gmail.comAn LZ78 compressing %, which supports efficient ' operations Ga type-constrained * operation Hcontruct an LZ78-compressed % using a 01* internally, requires an instance of Ord. Icontruct an LZ78-compressed %6 using a list internally, requires an instance of Eq. J*QuickCheck property: decode . encode = id K,QuickCheck property: decode . encodeEq = id ; !"#$%&'()*+,FGHIJKFGHIJKFGHIJK (non-portable (overloaded strings, MPTCs) experimentalekmett@gmail.com'LMNLMNLMNMN portable experimentalekmett@gmail.comOA &' is just a &2. with one object. This fakes that with a GADT PThe &'7 of the endomorphisms over some object in an arbitrary &2. S Extract the &' from its representation as a &2 TConvert a value in a &' into an arrow in a &2. /OPQRSTPQROSTOPQRQRST portable experimentalekmett@gmail.comUVUVUVportable experimentalekmett@gmail.comUVWWW"portable (but instances use MPTCs) experimentalekmett@gmail.comX Convert a &' into a ^ . Mnemonic: Exp a * Exp b = Exp (a + b) [ Convert a ^ into a &' . Mnemonic: Log a + Log b = Log (a * b) 'UVXYZ[\]^_` ^_`[\]XYZ XYZYZ[\]\]^_`_`portable experimentalekmett@gmail.com)UVWXYZ[\]^_`aaaportable (instances use MPTCs) experimentalekmett@gmail.comb a * (b + c) = (a * b) + (a * c)c (a + b) * c = (a * c) + (b * c))UVXYZ[\]^_`bcbcbcnon-portable (MPTCs) experimentalekmett@gmail.comdA d is an instance of both ^ and &' where  ` distributes over U . *UVXYZ[\]^_`bcdddeThe &' (&3,&() over &( a where &( is the top element hThe &' (&3,&() over &( a where &( is the bottom element kThe &' given by (&3,&4) nThe &' (&3,&4) efghijklmnopqrnopklmhijqefgrefgfghijijklmlmnopopqr experimentalekmett@gmail.comsA d which adds &4 and &4 to a pre-existing type. wA d using a type's built-in Bounded instance. 1UVXYZ[\]^_`bcdstuvwxywxysvutsvuttuvwxyxyzThe d (&3,&4) 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 0UVXYZ[\]^_`bcdz{|}}z{|z{|{|}5portable experimentalekmett@gmail.com+UVWXYZ[\]^_`abcportable experimentalEdward Kmett <ekmett@gmail.com>~Minimal complete definition:  or  "UV~~~portable experimentalekmett@gmail.com$UV~portable experimentalekmett@gmail.com&UVW~portable (instances use MPTCs) experimentalekmett@gmail.com/UVXYZ[\]^_`bcd~non-portable (MPTCs) experimentalekmett@gmail.com2UVXYZ[\]^_`bcd~non-portable (MPTCs) experimentalekmett@gmail.com2UVXYZ[\]^_`bcd~?non-portable (MPTCs, scoped types, empty decls, type operators) experimentalEdward Kmett <ekmett@gmail.com>4UVXYZ[\]^_`bcd~non-portable (MPTCs) experimentalekmett@gmail.com  (x *. m) .* y = x *. (m .* y)  (m .* x) * y = m .* (x * y)  (x * y) *. m = x * (y *. m)4UVXYZ[\]^_`bcd~non-portable (MPTCs) experimentalekmett@gmail.comif m is a  over r and f is a &6 then f  m is a  over r as well A  turns any &6 instance into a &'.  It also provides a ^ instance for an &6 functor wrapped around a &'  and asserts that any &6 applied to a &' forms a b  under these operations. A  uses an glues together &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 FUVXYZ[\]^_`bcd~ non-portable (MPTCs) experimentalekmett@gmail.comif m is a  over r and f is a &7 then f  m is a  as well A  turns any &7 instance into a &'.  It also provides a ^ instance for a &7 wrapped around a &'  and asserts that any &7 applied to a &' forms a b  under these operations. An  uses glues together &7 actions with (>>)  in the manner of &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 ;UVXYZ[\]^_`bc  #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    &4   1The sum of a collection of actions, generalizing  &8   ,   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    &4   1The sum of a collection of actions, generalizing  &8   ,   Efficiently ' a % using the D C 4 monoid. A specialized version of its namesake from  Data.Foldable   + E  Type specialization of foldMap above  Efficiently * a % using the D C 4 monoid. A specialized version of its namesake from  Data.Foldable   , E   Convert any %. to a list of its contents. Specialization of *  Efficiently * a % that contains values of type  -9   , &'  Efficiently * a % that contains values of type  -9   , &'  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     &' 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 A 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. N !"#$%&'()*+,!non-portable (MPTCs) experimentalekmett@gmail.com7 !"#$%&'()*+,"portable experimentalekmett@gmail.comA % which supports efficient '* operations over run-length encoded data. #A single run with a strict length. naive left to right encoder *QuickCheck property: decode . encode = id ? !"#$%&'()*+, ##non-portable (type families, MPTCs) experimentalekmett@gmail.com,UVXYZ[\]^_`bcd$5UVXYZ[\]^_`bcd~ :;<=>?@ABCDEFGGHIIJKLMNNOPQRSSTUUVWWXYZ[\]^_`abcdefghijklmnopdqrstu v v w x y z { | } ~ ~      !!""""""y"""z"|##$&'&(&)&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'&'*+*+&-.& 01 &2 &2 &2 &2 &2&&(&&&&&6&6&&7&7&&-9 monoids-0.1.21Data.Monoid.ReducerData.Monoid.Reducer.Char Data.Monoid.Lexical.UTF8.DecoderData.Monoid.Reducer.WithData.Monoid.UnionData.Monoid.Generator"Data.Monoid.Lexical.SourcePositionData.Monoid.Lexical.WordsData.Monoid.SelfData.Monoid.Generator.LZ78Data.Monoid.FromStringData.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.Sugar Data.RingData.Ring.BooleanData.Ring.FromNumData.Ring.ModularArithmeticData.Ring.ModuleData.Monoid.ApplicativeData.Monoid.MonadData.Monoid.CombinatorsData.Monoid.Generator.FreeData.Monoid.Generator.RLEData.Ring.Semi.Natural)Data.Ring.Module.AutomaticDifferentiationData.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.BoolReducerunitsnoccons 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 getFromStringCMonoidGEndogetGEndocategoryToMonoidmonoidToCategorypluszero+ExpgetExpLoggetLogMultiplicativeonetimes*LeftSemiNearRingRightSemiNearRingSemiRing MinPrioritygetMinPriority MaxPrioritygetMaxPriorityMingetMinMaxgetMax minfinityinfinityPriorityMaxBoundMinBoundOrdergetOrderTropical getTropicalGroupgnegateminus gsubtract replicate!prop_replicate_right_distributive-negatesubtractRingBoolRing getBoolRingFromNum getFromNumModularmodulusModgetModwithIntegralModulusModule RightModule.* LeftModule*.AppgetAppAltgetAlt Traversal getTraversal snocTraversalMongetMonMonadSum getMonadSumAction getAction snocAction traverse_for_asummapM_forM_msumfoldMap concatMapfoldtoListandoranyallsumproductelemnotElemfilter filterWithfindcyclerepeatFree AnyGeneratorRLEgetRLERun encodeListprop_decode_encodeListNaturalnaturalDMonoidMaybeFoldablemappendmconcatmemptygetDualDualappEndoEndogetAllAllgetAnyAnygetSumSum getProductProductgetFirstFirstgetLastLast FingerTreemeasureGHC.WordWord8Char GHC.UnicodeisSpaceTokenMapCategory>>><<<.id GHC.ClassesminNothingmaxGHC.EnummaxBoundminBoundGHC.Num Applicative AlternativeGHC.BaseMonad MonadPlusflipGHC.ListconcatBool