úÎ*L'/      !"#$%&'()*+,-.None 13456FKT&·GA list but with a balanced enumeration of Cartesian product such that 7 fmap sum (sequence (replicate n (fromList [0..]))) is monotonically increasing.Example: ’ sequence [fromList [0,1], fromList [0,1,2]] = fromDiagonals [ [[0,0]] , [[1,0],[0,1]] , [[1,1],[0,2]] , [[1,2]] ] ßThis variation is useful in at least two ways. One, it is not stuck on infinite factors. Two, if the factors are ordered then the product is similarly ordered; this can lend to efficient searching of product elements.ÿ4Note that this method fails for the infinitary product even if every factor is known to be non-empty. The first element is known but following it are infinite elements that each draw a second element from one of the infinite factors. A product element drawing a third factor element is never reached.3Finds the diagonals through a ragged list of lists.For example, the diagonals of: 3 [ [0,1,2] , [] , [3,4] , [5,6,7] ] Are: @ [ [0] , [1] , [3,2] , [5,4] , [6] , [7] ] Which can be seen intuitively.ëThis algorithm works by storing a list of tails of rows already seen. To find the next diagonal we take the head of the next row plus the head of each stored tail. The tail remainders are stored plus the remainder of the new row.™If there are no more rows but some remaining tails we then iteratively form diagonals from the heads of each tail until there are no tails remaining.Applied to the example: ð Row | Output | Remaining --------+--------+---------------- [0,1,2] | [0] | [[1,2]] [] | [1] | [[2]] [3,4] | [3,2] | [[4]] [5,6,7] | [5,4] | [[6,7]] x | [6] | [[7]] x | [7] | [] (Convert a list of diagonals to a ZigZag. I fromDiagonals . toDiagonals = id toDiagonals . fromDiagonals = id Convert a list to a ZigZag. 5 fromList . toList = id toList . fromList = id /(Zips up to the longest list rather than ( which zips up to the shortest list.Example: * tie id [1] [3,4] = [Both 1 3, That 4] (Convert a ZigZag to a list of diagonals. I fromDiagonals . toDiagonals = id toDiagonals . fromDiagonals = id Convert a ZigZag to a list. 5 fromList . toList = id toList . fromList = id 0 Undo '(:)'.123456789:      !"#$%&'()*+,-./0123456789::;</data-list-zigzag-0.1.1.1-GTC4rec4u5n4H8zxfwSeuBData.List.ZigZagGHC.ListzipZigZag diagonals fromDiagonalsfromList toDiagonalstoList$fIsListDiagonal $fShow1ZigZag $fShowZigZag$fSemigroupZigZag $fRead1ZigZag $fReadZigZag $fOrd1ZigZag$fMonoidZigZag$fMonadPlusZigZag $fMonadZigZag$fIsListZigZag $fEq1ZigZag$fApplicativeZigZag$fAlternativeZigZag$fAlternativeDiagonal$fApplicativeDiagonal$fDataDiagonal $fEqDiagonal $fEq1Diagonal$fFoldableDiagonal$fFunctorDiagonal$fGenericDiagonal$fGeneric1Diagonal$fMonadDiagonal$fMonadPlusDiagonal$fMonoidDiagonal $fOrdDiagonal$fOrd1Diagonal$fReadDiagonal$fSemigroupDiagonal$fShowDiagonal$fShow1Diagonal$fTraversableDiagonal $fDataZigZag $fEqZigZag$fFoldableZigZag$fFunctorZigZag$fGenericZigZag$fGeneric1ZigZag $fOrdZigZag$fTraversableZigZagtieunconsunZigZagTheseThisThatBothDiagonal unDiagonal