h$7S3      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~None`discriminationOptimized and CPS'd version of 5, where all lefts are known to come before all rights(c) Edward Kmett 2015 BSD-styleEdward Kmett  non-portableNonediscrimination=Mutable boxed arrays associated with a primitive state token. discrimination Boxed arrays discriminationCreate a new mutable array of the specified size and initialise all elements with the given value. discrimination/Read a value from the array at the given index.discrimination.Write a value to the array at the given index.discrimination9Read a value from the immutable array at the given index.discriminationMonadically read a value from the immutable array at the given index. This allows us to be strict in the array while remaining lazy in the read element which is very useful for collective operations. Suppose we want to copy an array. We could do something like this: copy marr arr ... = do ... writeSmallArray marr i (indexSmallArray arr i) ... ...2But since primitive arrays are lazy, the calls to ! will not be evaluated. Rather, marr will be filled with thunks each of which would retain a reference to arr&. This is definitely not what we want!With , we can instead write copy marr arr ... = do ... x <- indexSmallArrayM arr i writeSmallArray marr i x ...Now, indexing is executed immediately although the returned element is still not evaluated.discriminationConvert a mutable array to an immutable one without copying. The array should not be modified after the conversion.discriminationConvert an immutable array to an mutable one without copying. The immutable array should not be used after the conversion.discrimination non-portable Trustworthy %discriminationBuild a singleton WordMap!"#$%&'!%'"#$& Trustworthy '(39? /discrimination; equipped with a compatible stable unordered discriminator.Law: 5 x y D (x  y) Note:  is a moral super class of /.. It isn't because of some missing instances.0discriminationFor every surjection f,  f 0 D 0 1discrimination)Productive Stable Unordered Discriminator4discriminationThis may be useful for pragmatically accelerating a grouping structure by preclassifying by a hash function Semantically, grouping = hashing <> grouping 5discriminationValid definition for () in terms of /.7discriminationO(n) . Similar to  2, except we do not require groups to be clustered.This combinator still operates in linear time, at the expense of storing history.#The result equivalence classes are not$ sorted, but the grouping is stable. 7 = 8  8discriminationO(n). This is a replacement for   using discrimination.#The result equivalence classes are not$ sorted, but the grouping is stable.9discriminationO(n). This upgrades   from  Data.List from O(n^2) to O(n)/ by using productive unordered discrimination. 9 = :  9 as =   7 as :discriminationO(n) . Online 9 with a Schwartzian transform. : f as =   8 f as -./0123456789:123/0-.9:78564None9?(fdiscrimination: equipped with a compatible stable, ordered discriminator.Law: k x y D  x y gdiscrimination0For every strictly monotone-increasing function f:  f g D g hdiscriminationStable Ordered DiscriminatorkdiscriminationValid definition for  in terms of f.mdiscriminationConstruct a stable ordered discriminator that sorts a list as multisets of elements from another stable ordered discriminator.The resulting discriminator only cares about the set of keys and their multiplicity, and is sorted as if we'd sorted each key in turn before comparing.ndiscriminationConstruct a stable ordered discriminator that sorts a list as sets of elements from another stable ordered discriminator.The resulting discriminator only cares about the set of keys, and is sorted as if we'd sorted each key in turn before comparing.pdiscrimination O(n)#. Sort a list using discrimination. p = q  qdiscriminationO(n). Sort a list with a Schwartzian transformation by using discrimination.!This linear time replacement for   and   uses discrimination.rdiscriminationO(n). Construct a .,This is an asymptotically faster version of (, which exploits ordered discrimination.toMap [] fromList [])toMap [(5,"a"), (3 :: Int,"b"), (5, "c")]fromList [(3,"b"),(5,"c")]0Map.fromList [(5,"a"), (3 :: Int,"b"), (5, "c")]fromList [(3,"b"),(5,"c")])toMap [(5,"c"), (3,"b"), (5 :: Int, "a")]fromList [(3,"b"),(5,"a")]0Map.fromList [(5,"c"), (3,"b"), (5 :: Int, "a")]fromList [(3,"b"),(5,"a")]sdiscriminationO(n). Construct a , combining values.,This is an asymptotically faster version of (, which exploits ordered discrimination.(Note: values combine in anti-stable order for compatibility with )toMapWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5 :: Int,"c")]fromList [(3,"ab"),(5,"cba")]Map.fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5 :: Int,"c")]fromList [(3,"ab"),(5,"cba")]toMapWith (++) [] fromList []tdiscriminationO(n). Construct a *, combining values with access to the key.,This is an asymptotically faster version of (, which exploits ordered discrimination.(Note: the values combine in anti-stable order for compatibility with )let f key new_value old_value = show key ++ ":" ++ new_value ++ "|" ++ old_valuetoMapWithKey f [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5 :: Int,"c")]&fromList [(3,"3:a|b"),(5,"5:c|5:b|a")]toMapWithKey f [] fromList []udiscriminationO(n). Construct an . toIntMap [] fromList []%toIntMap [(5,"a"), (3,"b"), (5, "c")]fromList [(3,"b"),(5,"c")],IntMap.fromList [(5,"a"), (3,"b"), (5, "c")]fromList [(3,"b"),(5,"c")]%toIntMap [(5,"c"), (3,"b"), (5, "a")]fromList [(3,"b"),(5,"a")],IntMap.fromList [(5,"c"), (3,"b"), (5, "a")]fromList [(3,"b"),(5,"a")]vdiscriminationO(n). Construct an , combining values.,This is an asymptotically faster version of (, which exploits ordered discrimination.(Note: values combine in anti-stable order for compatibility with )?toIntMapWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"c")]fromList [(3,"ab"),(5,"cba")]IntMap.fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"c")]fromList [(3,"ab"),(5,"cba")]toIntMapWith (++) [] fromList []wdiscriminationO(n). Construct a *, combining values with access to the key.,This is an asymptotically faster version of (, which exploits ordered discrimination.(Note: the values combine in anti-stable order for compatibility with )let f key new_value old_value = show key ++ ":" ++ new_value ++ "|" ++ old_value?toIntMapWithKey f [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"c")]&fromList [(3,"3:a|b"),(5,"5:c|5:b|a")]IntMap.fromListWithKey f [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"c")]&fromList [(3,"3:a|b"),(5,"5:c|5:b|a")]toIntMapWithKey f [] fromList []xdiscriminationO(n). Construct a  in linear time.,This is an asymptotically faster version of (, which exploits ordered discrimination.ydiscriminationO(n). Construct an  in linear time.,This is an asymptotically faster version of (, which exploits ordered discrimination.defghijklmnopqrstuvwxyhijfgdepqokrstuvwxylmnNone2discriminationO(n). Perform a full outer join while explicit merging of the two result tables a table at a time.-The results are grouped by the discriminator.discriminationO(n). Perform an inner join, with operations defined one row at a time.-The results are grouped by the discriminator.This takes operation time linear in both the input and result sets.discriminationO(n). Perform a full outer join with operations defined one row at a time.-The results are grouped by the discriminator.This takes operation time linear in both the input and result sets.discriminationO(n). Perform a left outer join with operations defined one row at a time.-The results are grouped by the discriminator.This takes operation time linear in both the input and result sets.discriminationO(n). Perform a right outer join with operations defined one row at a time.-The results are grouped by the discriminator.This takes operation time linear in both the input and result sets.discriminationthe discriminator to usediscriminationhow to join two tablesdiscriminationselector for the left tablediscriminationselector for the right tablediscrimination left tablediscrimination right tablediscriminationthe discriminator to usediscriminationhow to join two rowsdiscriminationselector for the left tablediscriminationselector for the right tablediscrimination left tablediscrimination right tablediscriminationthe discriminator to usediscriminationhow to join two rowsdiscrimination-row present on the left, missing on the rightdiscrimination-row present on the right, missing on the leftdiscriminationselector for the left tablediscriminationselector for the right tablediscrimination left tablediscrimination right tablediscriminationthe discriminator to usediscriminationhow to join two rowsdiscrimination-row present on the left, missing on the rightdiscriminationselector for the left tablediscriminationselector for the right tablediscrimination left tablediscrimination right tablediscriminationthe discriminator to usediscriminationhow to join two rowsdiscrimination-row present on the right, missing on the leftdiscriminationselector for the left tablediscriminationselector for the right tablediscrimination left tablediscrimination right tableNone3 )-./012356789:defghijkmnopqrstuvwxy)123/0-.9:7865hijfgdeopqmnkrstuvwxy !""##$%&'()*+,-./0123456789:;<=>?@ABCDEFGHHIJKL   MNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{{|}~(discrimination-0.5-H9BILMzBkaqGaTavAT9uqData.Discrimination.Internal'Data.Discrimination.Internal.SmallArray$Data.Discrimination.Internal.WordMapData.Discrimination.GroupingData.Discrimination.SortingData.Discrimination.Class Data.EitherpartitionEithers Data.ListgroupGHC.Exts groupWithnubControl.Applicative<$>sortWithsortOnData.MapfromList fromListWithfromListWithKeyData.IntMap.LazyData.Set Data.IntSetData.DiscriminationbdiscNatrunsgroupNum updateBag updateSet spanEither integerCases naturalCasesSmallMutableArray SmallArray newSmallArrayreadSmallArraywriteSmallArrayindexSmallArrayindexSmallArrayMunsafeFreezeSmallArrayunsafeThawSmallArraysameSmallMutableArraycopySmallArraycopySmallMutableArraycloneSmallArraycloneSmallMutableArray$fNFDataSmallArray$fEqSmallArray$fOrdSmallArray$fReadSmallArray$fShowSmallArray$fTraversableSmallArray$fFoldableSmallArray$fFunctorSmallArray$fIsListSmallArrayWordMapinsertlookupmember singletonempty$fTraversableWordMap$fFoldableWordMap$fFunctorWordMap$fNFDataWordMap $fShowWordMap Grouping1 grouping1GroupinggroupingGroupgetGrouphashing groupingEqrunGroupnubWith $fMonoidGroup$fSemigroupGroup$fDecidableGroup$fDivisibleGroup$fContravariantGroup$fGroupingRatio$fGroupingNatural$fGroupingInteger$fGroupingComplex$fGroupingEither$fGroupingMaybe$fGroupingNonEmpty $fGrouping[]$fGrouping(,,,)$fGrouping(,,) $fGrouping(,)$fGroupingOrdering$fGroupingBool$fGroupingChar $fGroupingInt$fGroupingInt64$fGroupingInt32$fGroupingInt16$fGroupingInt8$fGroupingWord$fGroupingWord64$fGroupingWord32$fGroupingWord16$fGroupingWord8 $fGrouping()$fGroupingVoid$fGrouping1Complex$fGrouping1Compose$fGrouping1(,,,)$fGrouping1(,,)$fGrouping1(,)$fGrouping1Either$fGrouping1NonEmpty$fGrouping1Maybe $fGrouping1[]$fGroupingComposeSorting1sorting1SortingsortingSortrunSortsortingCompare sortingNat sortingBag sortingSetdescsorttoMap toMapWith toMapWithKeytoIntMap toIntMapWithtoIntMapWithKeytoSettoIntSet $fMonoidSort$fSemigroupSort$fDecidableSort$fDivisibleSort$fContravariantSort$fSorting(,,,) $fSorting(,,) $fSorting(,)$fSortingEither$fSortingMaybe$fSortingNonEmpty $fSorting[]$fSortingOrdering $fSortingBool $fSortingVoid $fSortingChar $fSortingInt$fSortingInt64$fSortingInt32$fSortingInt16 $fSortingInt8 $fSortingWord$fSortingWord64$fSortingWord32$fSortingWord16$fSortingWord8$fSortingNatural$fSortingInteger $fSorting()$fSorting1Either$fSorting1Maybe$fSorting1NonEmpty $fSorting1[]$fSorting1Compose$fSortingComposeDiscriminatingdiscjoininginnerouter leftOuter rightOuter$fDiscriminatingGroup$fDiscriminatingSortghc-prim GHC.ClassesEq==baseData.Functor.Contravariant contramapGHC.BaseidGHC.ListheadOrdcomparecontainers-0.6.2.1Data.Map.InternalMapData.IntMap.InternalIntMapData.Set.InternalSetData.IntSet.InternalIntSet