!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ SafeMbThe strict sequence type. See Data.Nested.Seq.Quaternary.Lazy for more information.We maintain the invariant that (Z Nil)X never appears. This function checks whether this is satisfied. Used only for testing."Prepending an element. Worst case  O(log(n)), but amortized O(1). Worst case  O(log(n)) , amortized O(1).Checks whether the sequence is empty. This is O(1).The length of a sequence.  O(log(n)).The empty sequence.Conversion from a list. O(n).Conversion to a list. O(n). Naive implementation of *First element of the sequence. Worst case  O(log(n)) , amortized O(1).!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).Last element of the sequence.  O(log(n)).*First element of the sequence. Worst case  O(log(n)) , amortized O(1).Last element of the sequence.  O(log(n))!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).=All tails of the sequence (starting with the sequence itself) Lookup the k.-th element of a sequence. This is worst case  O(log(n)) and amortized  O(log(k)), and quite efficient. Update the k-th element of a sequence.  Replace the k -th element. !replace n x == update (const x) nDrop is efficient: drop k is amortized  O(log(k)), worst case maybe  O(log(n)^2) ?O(n) (for large n at least), where n% is the length of the first sequence.Take is slow: O(n)>The sequence without the last element. Warning, this is slow, O(n)>The sequence without the last element. Warning, this is slow, O(n)Warning, this is slow: O(n) (with bad constant factor).@Stripping the last element from a sequence is a slow operation, O(n)6. If you only need extracting the last element, use  instead, which is fast. DShow the internal structure of the sequence. The constructor names Z and O* come from "zero" and "one", respectively.!Generates a graphviz DOT3 file, showing the internal structure of a sequence.You can furthermore set the shape of the nodesE        !name of the fivee constuctors: (Nil,Zero,One,Two,Three) precedence!"#$%&'()*"  !"   !=        !!"#$%&'()*SafeMb-The lazy sequence type.The underlying (nested) data structure corresponds to the quaternary representation of the length of the list. It looks like this: data Seq a = Nil | Zero (Seq (a,a,a,a)) | One a (Seq (a,a,a,a)) | Two a a (Seq (a,a,a,a)) | Three a a a (Seq (a,a,a,a))+Furthermore we maintain the invariant that Zero Nil never appears..We maintain the invariant that (Z Nil)X never appears. This function checks whether this is satisfied. Used only for testing./"Prepending an element. Worst case  O(log(n)), but amortized O(1).0 Worst case  O(log(n)) , amortized O(1)1.Checks whether the sequence is empty. This is O(1).2The length of a sequence.  O(log(n)).3The empty sequence.4Conversion from a list. O(n).5Conversion to a list. O(n).6Naive implementation of 5;*First element of the sequence. Worst case  O(log(n)) , amortized O(1).<!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).=Last element of the sequence.  O(log(n)).>*First element of the sequence. Worst case  O(log(n)) , amortized O(1).?Last element of the sequence.  O(log(n))@!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).A=All tails of the sequence (starting with the sequence itself)B Lookup the k.-th element of a sequence. This is worst case  O(log(n)) and amortized  O(log(k)), and quite efficient.D Update the k-th element of a sequence. E Replace the k -th element. !replace n x == update (const x) nFDrop is efficient: drop k is amortized  O(log(k)), worst case maybe  O(log(n)^2) ?GO(n) (for large n at least), where n% is the length of the first sequence.HTake is slow: O(n)I>The sequence without the last element. Warning, this is slow, O(n)J>The sequence without the last element. Warning, this is slow, O(n)KWarning, this is slow: O(n) (with bad constant factor).L@Stripping the last element from a sequence is a slow operation, O(n)6. If you only need extracting the last element, use ? instead, which is fast. MDShow the internal structure of the sequence. The constructor names Z and O* come from "zero" and "one", respectively.NGenerates a graphviz DOT3 file, showing the internal structure of a sequence".You can furthermore set the shape of the nodesC#$%&-'()*+,-../01/2301245634576789:;<=>?@ABCDEFGHIJKLM89name of the fivee constuctors: (Nil,Zero,One,Two,Three) precedenceN"OPQRSTUVW"-./0123456789:;<=>?@ABCDEFGHIJKLMN"-/012354789:;<=>@A?BCDEFGHIJKL6.MN<#$%&-'()*+,-../01/2301245634576789:;<=>?@ABCDEFGHIJKLM89N"OPQRSTUVWSafeb"-./0123456789:;<=>?@ABCDEFGHIJKLMNSafeMbXThe strict sequence type. See Data.Nested.Seq.Ternary.Lazy for more information.YWe maintain the invariant that (Z Nil)X never appears. This function checks whether this is satisfied. Used only for testing.Z"Prepending an element. Worst case  O(log(n)), but amortized O(1).[ Worst case  O(log(n)) , amortized O(1)\.Checks whether the sequence is empty. This is O(1).]The length of a sequence.  O(log(n)).^The empty sequence._Conversion from a list. O(n).`Conversion to a list. O(n).aNaive implementation of `f*First element of the sequence. Worst case  O(log(n)) , amortized O(1).g!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).hLast element of the sequence.  O(log(n)).i*First element of the sequence. Worst case  O(log(n)) , amortized O(1).jLast element of the sequence.  O(log(n))k!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).l=All tails of the sequence (starting with the sequence itself)m Lookup the k.-th element of a sequence. This is worst case  O(log(n)) and amortized  O(log(k)), and quite efficient.o Update the k-th element of a sequence. p Replace the k -th element. !replace n x == update (const x) nqDrop is efficient: drop k is amortized  O(log(k)), worst case maybe  O(log(n)^2) ?rO(n) (for large n at least), where n% is the length of the first sequence.sTake is slow: O(n)t>The sequence without the last element. Warning, this is slow, O(n)u>The sequence without the last element. Warning, this is slow, O(n)vWarning, this is slow: O(n) (with bad constant factor).w@Stripping the last element from a sequence is a slow operation, O(n)6. If you only need extracting the last element, use j instead, which is fast. xDShow the internal structure of the sequence. The constructor names Z and O* come from "zero" and "one", respectively.yGenerates a graphviz DOT3 file, showing the internal structure of a sequence:.You can furthermore set the shape of the nodesB;<=X>?@ABCDEFYGHIZJ[\]KLM^_`NabcdefghijklmnopqrstuvwxOPname of the foure constuctors: (Nil,Zero,One,Two) precedencey:z{|}~"XYZ[\]^_`abcdefghijklmnopqrstuvwxy"XZ[\]^`_bcdefghikljmnopqrstuvwaYxy;;<=X>?@ABCDEFYGHIZJ[\]KLM^_`NabcdefghijklmnopqrstuvwxOPy:z{|}~SafeMbThe lazy sequence type.~The underlying (nested) data structure corresponds to the binary representation of the length of the list. It looks like this: cdata Seq a = Nil | Zero (Seq (a,a,a)) | One a (Seq (a,a,a)) | Two a a (Seq (a,a,a))+Furthermore we maintain the invariant that Zero Nil never appears.We maintain the invariant that (Z Nil)X never appears. This function checks whether this is satisfied. Used only for testing."Prepending an element. Worst case  O(log(n)), but amortized O(1). Worst case  O(log(n)) , amortized O(1).Checks whether the sequence is empty. This is O(1).The length of a sequence.  O(log(n)).The empty sequence.Conversion from a list. O(n).Conversion to a list. O(n).Naive implementation of *First element of the sequence. Worst case  O(log(n)) , amortized O(1).!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).Last element of the sequence.  O(log(n)).*First element of the sequence. Worst case  O(log(n)) , amortized O(1).Last element of the sequence.  O(log(n))!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).=All tails of the sequence (starting with the sequence itself) Lookup the k.-th element of a sequence. This is worst case  O(log(n)) and amortized  O(log(k)), and quite efficient. Update the k-th element of a sequence.  Replace the k -th element. !replace n x == update (const x) nDrop is efficient: drop k is amortized  O(log(k)), worst case maybe  O(log(n)^2) ?O(n) (for large n at least), where n% is the length of the first sequence.Take is slow: O(n)>The sequence without the last element. Warning, this is slow, O(n)>The sequence without the last element. Warning, this is slow, O(n)Warning, this is slow: O(n) (with bad constant factor).@Stripping the last element from a sequence is a slow operation, O(n)6. If you only need extracting the last element, use  instead, which is fast. DShow the internal structure of the sequence. The constructor names Z and O* come from "zero" and "one", respectively.Generates a graphviz DOT3 file, showing the internal structure of a sequenceQ.You can furthermore set the shape of the nodes@RSTUVWXYZ[\]^_`abcdename of the foure constuctors: (Nil,Zero,One,Two) precedenceQ"":RSTUVWXYZ[\]^_`abcdeQSafeb"SafeMb!The strict sequence type. See Data.Nested.Seq.Lazy for more detailed information.fempty sequenceg^even sequence (we will use a pattern synonym to maintain an invariant, hence the strange name)h odd sequenceWe maintain the invariant that (Z Nil)X never appears. This function checks whether this is satisfied. Used only for testing."Prepending an element. Worst case  O(log(n)), but amortized O(1). Worst case  O(log(n)) , amortized O(1).Checks whether the sequence is empty. This is O(1).The length of a sequence.  O(log(n)).The empty sequence.Conversion from a list. O(n).Conversion to a list. O(n).Naive implementation of *First element of the sequence. Worst case  O(log(n)) , amortized O(1).!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).Last element of the sequence.  O(log(n)).*First element of the sequence. Worst case  O(log(n)) , amortized O(1).Last element of the sequence.  O(log(n))!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).=All tails of the sequence (starting with the sequence itself) Lookup the k.-th element of a sequence. This is worst case  O(log(n)) and amortized  O(log(k)), and quite efficient. Update the k-th element of a sequence.  Replace the k -th element. !replace n x == update (const x) nDrop is efficient: drop k is amortized  O(log(k)), worst case maybe  O(log(n)^2) ?O(n) (for large n at least), where n% is the length of the first sequence.Take is slow: O(n)>The sequence without the last element. Warning, this is slow, O(n)>The sequence without the last element. Warning, this is slow, O(n)Warning, this is slow: O(n) (with bad constant factor).@Stripping the last element from a sequence is a slow operation, O(n)6. If you only need extracting the last element, use  instead, which is fast. DShow the internal structure of the sequence. The constructor names Z and O* come from "zero" and "one", respectively.Generates a graphviz DOT3 file, showing the internal structure of a sequencei.You can furthermore set the shape of the nodes?jklfghmnopqrstuvwxyname of the three constuctors: (Nil,Even,Odd) precedencei""9jklfghmnopqrstuvwxyiSafeMb!The lazy sequence type.~The underlying (nested) data structure corresponds to the binary representation of the length of the list. It looks like this: @data Seq a = Nil | Even (Seq (a,a)) | Odd a (Seq (a,a))+Furthermore we maintain the invariant that Even Nil never appears.If the Odd* constructor was missing, this would be a full binary tree. Note that the nested data type representation has two advantages compared to a naive binary tree type (by which we mean the usual data Tree a = Node a a | Leaf a construction): First, the type system guarantees the fullness; second, it has smaller memory footprint, since in the naive case, the LeafC constructors introduce two extra words (a tag word and a pointer). With the Odd constructor thrown in, this is a sequence of larger and larger full binary trees. Looking at the binary representation of the length of the list, we will have full binary trees corresponding to the positions of 1 digits.MFor example, here are how sequences of lengths 4, 5, 6 and 7 are represented: doc/seq4.png  doc/seq5.png  doc/seq6.png doc/seq7.pngzempty sequence{^even sequence (we will use a pattern synonym to maintain an invariant, hence the strange name)| odd sequenceWe maintain the invariant that (Z Nil)X never appears. This function checks whether this is satisfied. Used only for testing."Prepending an element. Worst case  O(log(n)), but amortized O(1). Worst case  O(log(n)) , amortized O(1).Checks whether the sequence is empty. This is O(1).The length of a sequence.  O(log(n)).The empty sequence.Conversion from a list. O(n).Conversion to a list. O(n).Naive implementation of *First element of the sequence. Worst case  O(log(n)) , amortized O(1).!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).Last element of the sequence.  O(log(n)).*First element of the sequence. Worst case  O(log(n)) , amortized O(1).Last element of the sequence.  O(log(n))!Tail of the sequence. Worst case  O(log(n)) , amortized O(1).=All tails of the sequence (starting with the sequence itself) Lookup the k.-th element of a sequence. This is worst case  O(log(n)) and amortized  O(log(k)), and quite efficient. Update the k-th element of a sequence.  Replace the k -th element. !replace n x == update (const x) nDrop is efficient: drop k is amortized  O(log(k)), worst case maybe  O(log(n)^2) ?O(n) (for large n at least), where n% is the length of the first sequence.Take is slow: O(n)>The sequence without the last element. Warning, this is slow, O(n)>The sequence without the last element. Warning, this is slow, O(n)Warning, this is slow: O(n) (with bad constant factor).@Stripping the last element from a sequence is a slow operation, O(n)6. If you only need extracting the last element, use  instead, which is fast. DShow the internal structure of the sequence. The constructor names Z and O* come from "zero" and "one", respectively.Generates a graphviz DOT3 file, showing the internal structure of a sequence}.You can furthermore set the shape of the nodes=~z{|name of the three constuctors: (Nil,Even,Odd) precedence}""8~z{|} Safeb" Safeb"-./0123456789:;<=>?@ABCDEFGHIJKLMN    !"#$%&'()*+,-./01234567    !"#$%&'()*+,-./012345    !"#$%&'()*+,-./01234589    !"#$%&'()*+,-./012345    !"#$%&'()*+,-./012345:;    !"#$%&'()*+,-./012345<==>?@ABCDEEFDGHIJKLMNOPQR<==>D?@ABCFDGHIJKLMNOPQR<==>?@ABSTTFSGHIKMNOPQR<==>S?@ABFSGHIKMNOPQR?@A<==>UVVFUGHMNOPQR?@A<==>UFUGHMNOPQRW*nested-sequence-0.2-7tmDBtP3Qn6GEhDAKA349s!Data.Nested.Seq.Quaternary.StrictData.Nested.Seq.Quaternary.LazyData.Nested.Seq.Ternary.StrictData.Nested.Seq.Ternary.LazyData.Nested.Seq.Binary.StrictData.Nested.Seq.Binary.LazyData.Nested.Seq.QuaternaryData.Nested.Seq.TernaryData.Nested.Seq.BinaryData.Nested.SeqSeqcheckInvariantconsunConsnulllengthemptyfromListtoList toListNaive singletonpairtriplequadheadtaillastmbHeadmbLastmbTailtailslookupmbLookupupdatereplacedropappendtakeinitmbInitsnocunSnoc showInternalgraphviz$fApplicativeState $fMonadState$fFunctorState $fFoldableSeq $fFunctorSeq $fShowSeq$fOrdSeq$fEqSeq $fMonoidSeq$fEqStrictQuad$fShowStrictQuad$fEqStrictTriple$fShowStrictTriple$fEqStrictPair$fShowStrictPair graphviz'StaterunStateNilZZOTDQuad StrictQuadZfstsndthdfthcons2cons3safeNull unsafeNull seqLength seqToListshowsPrecInternalshowsPrecInternal'Triple StrictTriplePair StrictPair