úÎNéKü1      !"#$%&'()*+,-./0Safe A wrapper for 1 where the   operator is defined only over 2 values.ExamplesTwo 2 s make a 3.5AppendRight (Right "ab") <>? AppendRight (Right "cd")1Just (AppendRight {unAppendRight = Right "abcd"})Anything else produces 43AppendRight (Left "ab") <>? AppendRight (Left "cd")Nothing combines consecutive 2 values, leaving the 5 values unmodified.Cxs = [Left "a", Left "b", Right "c", Right "d", Left "e", Left "f"];fmap unAppendRight . groupAndConcat . fmap AppendRight $ xs0[Left "a",Left "b",Right "cd",Left "e",Left "f"]A wrapper for 1 where the   operator is defined only over 5 values.ExamplesTwo 5 s make a 3.1AppendLeft (Left "ab") <>? AppendLeft (Left "cd").Just (AppendLeft {unAppendLeft = Left "abcd"})Anything else produces 43AppendLeft (Right "ab") <>? AppendLeft (Right "cd")Nothing combines consecutive 5 values, leaving the 2 values unmodified.Cxs = [Left "a", Left "b", Right "c", Right "d", Left "e", Left "f"]9fmap unAppendLeft . groupAndConcat . fmap AppendLeft $ xs)[Left "ab",Right "c",Right "d",Left "ef"]#A wrapper to turn any value with a 6 instance into a value with a   instance whose   operator always returns 3.ExamplesTotal "ab" <>? Total "cd"Just (Total {unTotal = "abcd"})f = getProduct . unTotalg = Total . Product(fmap f . partialConcat . fmap g $ [1..4]Just 24 A wrapper for 7 with an error-propagating 6. A   is like a 6!, but with an operator returning 7 a rather than a.For comparison: (8) :: 6 a => a -> a -> a ( ) ::   a => a -> a -> 7 a .The associativity axiom for partial semigroupsFor all x, y, z:If x   y = 3 xy and y   z = 3 yz, thenx   yz = xy   z.1Relationship to the semigroup associativity axiomfThe partial semigroup associativity axiom is a natural adaptation of the semigroup associativity axiom x 8 (y 8 z) = (x 8 y) 8 z;with a slight modification to accommodate situations where 8D is undefined. We may gain some insight into the connection between 6 and  I by rephrasing the partial semigroup associativity in terms of a partial 8 operator thusly:For all x, y, z:If x 8 y and y 8 z are both defined, thenx 8 (y 8 z) is defined if and only if (x 8 y) 8 z is defined, andif these things are4 all defined, then the axiom for total semigroups x 8 (y 8 z) = (x 8 y) 8 z must hold.yApply a semigroup operation to any pairs of consecutive list elements where the semigroup operation is defined over them.ExamplesFor 1, ! combines contiguous sublists of 5 and contiguous sublists of 2.Cxs = [Left "a", Right "b", Right "c", Left "d", Left "e", Left "f"]groupAndConcat xs [Left "a",Right "bc",Left "def"]If xsV is nonempty and the partial semigroup operator is defined for all pairs of values in xs, then  xs produces a 3C result with the combination of all the values. Otherwise, returns 4.Examples&When all values can combine, we get a 3 of their combination.,partialConcat [Left "a", Left "b", Left "c"]Just (Left "abc"),When some values cannot be combined, we get 4.-partialConcat [Left "a", Left "b", Right "c"]NothingWhen the list is empty, we get 4.partialConcat []NothingLike , but for non-empty lists.Examples&When all values can combine, we get a 3 of their combination.1partialConcat1 (Left "a" :| [Left "b", Left "c"])Just (Left "abc"),When some values cannot be combined, we get 4.2partialConcat1 (Left "a" :| [Left "b", Right "c"])NothingExamplesSIf lists are the same length and each pair of elements successfully, then we get a 3 result.$xs = [Left "a", Left "b", Right "c"]$ys = [Left "1", Left "2", Right "3"]partialZip xs ys%Just [Left "a1",Left "b2",Right "c3"]-If the pairs do not all combine, then we get 4.$xs = [Left "a", Left "b", Right "c"]%ys = [Left "1", Right "2", Right "3"]partialZip xs ysNothing1If the lists have different lengths, then we get 4.$xs = [Left "a", Left "b", Right "c"]ys = [Left "1", Left "2"]partialZip xs ysNothingLike , but for non-empty lists.ExamplesSIf lists are the same length and each pair of elements successfully, then we get a 3 result.&xs = Left "a" :| [Left "b", Right "c"]&ys = Left "1" :| [Left "2", Right "3"]partialZip1 xs ys*Just (Left "a1" :| [Left "b2",Right "c3"])-If the pairs do not all combine, then we get 4.&xs = Left "a" :| [Left "b", Right "c"]'ys = Left "1" :| [Right "2", Right "3"]partialZip1 xs ysNothing1If the lists have different lengths, then we get 4.&xs = Left "a" :| [Left "b", Right "c"]ys = Left "1" :| [Left "2"]partialZip1 xs ysNothing!          69      !"#$%&'()*+,-./01/02/34/35/06/78/39/7:;0partial-semigroup-0.2.0.1-64ofcYoj4MnEEAyYqj1lMEData.PartialSemigroup AppendRight unAppendRight AppendLeft unAppendLeftTotalunTotalPartial unPartialPartialSemigroup<>?groupAndConcat partialConcatpartialConcat1 partialZip partialZip1$fPartialSemigroupAppendRight$fPartialSemigroupAppendLeft$fPartialSemigroupTotal$fMonoidPartial$fSemigroupPartial$fPartialSemigroupZipList$fPartialSemigroup(,,)$fPartialSemigroup(,)$fPartialSemigroupEither$fPartialSemigroupIdentity$fPartialSemigroupProduct$fPartialSemigroupSum$fPartialSemigroup[]$fPartialSemigroup() $fEqPartial $fOrdPartial $fReadPartial $fShowPartial $fEqTotal $fOrdTotal $fReadTotal $fShowTotal$fEqAppendLeft$fOrdAppendLeft$fReadAppendLeft$fShowAppendLeft$fEqAppendRight$fOrdAppendRight$fReadAppendRight$fShowAppendRightbase Data.EitherEitherRightGHC.BaseJustNothingLeftData.Semigroup SemigroupMaybe<>