Îõ³h&¢ÁŸ&Œ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹Ä(c) 2019-2020 Veronika Romashkina (c) 2020-2022 KowainikMPL-2.0Kowainik StablePortable Safe-Inferred"%&(/25;?ÌÑÔÜãïUslist-Data type that represents lists size/lengths.ListlengthSize[]0Size 0[1..10]10Size 10[1..]hangsInfinityÂNote, that size is not suppose to have negative value, so use the  constructor carefully.slist Finite sizeslistInfinite size.slistÁReturns the list of sizes from zero to the given one (including).sizes $ Size 3[Size 0,Size 1,Size 2,Size 3] >> sizes Infinity [Size 0, Size 1, ..., Size Œ , Infinity] slist6The minimum possible size for the list is empty list: Size 0 The maximum possible size is .slist5Efficient implementations of numeric operations with s.Any operations with  size results into . When ’ is a left argument, all operations are also right-lazy. Operations are checked for integral overflow under the assumption that all values inside  are positive.Size 10 + Size 5Size 15Size 5 * InfinityInfinity#Infinity + error "Unevaluated size"InfinitySize (10 ^ 10) * Size (10 ^ 10)Infinity(c) 2021-2022 KowainikMPL-2.0Kowainik StablePortable Safe-Inferred"%&(/25;?ÌÑÔÚÜãïÀ slistãData type that represents sized list. Size can be both finite or infinite, it is established using  data type.slistO(n) . Constructs   from the given list. slist [1..5]+Slist {sList = [1,2,3,4,5], sSize = Size 5}Note: works with finite lists. Use  to construct infinite lists.slistO(1) . Constructs   from the given list. ?>> infiniteSlist [1..] Slist {sList = [1..], sSize = Infinity} Note: works with infinite lists. Use  to construct finite lists.slistO(1) . Creates  ) with a single element. The size of such   is always equals to Size 1.one "and only",Slist {sList = ["and only"], sSize = Size 1}slistO(1)*. Returns the length of a structure as an  . On infinite lists returns the s Œ. len $ one 421len $ slist [1..3]3len $ infiniteSlist [1..]9223372036854775807slistO(1). Returns the  of the slist.size $ slist "Hello World!"Size 12size $ infiniteSlist [1..]InfinityslistO(1) . Checks if   is emptyisEmpty memptyTrueisEmpty $ slist []TrueisEmpty $ slist "Not Empty"FalseslistO(1).  is   analogue to :à for lists. It adds the given element to the beginning of the list.$The following property is preserved:   ( x xs) ==  xs + 1  Examples:cons 'a' $ one 'b'$Slist {sList = "ab", sSize = Size 2} >>  0 $  [1..] Slist {sList = [0..], sSize = } slistO(n):. Applies the given function to each element of the slist. ‹map f (slist [x1, x2, ..., xn]) == slist [f x1, f x2, ..., f xn] map f (infiniteSlist [x1, x2, ...]) == infiniteSlist [f x1, f x2, ...]slistEfficient implementation of Ž and  functions.  returns s Œ on infinite lists.slistList appending. Use ‘ for   concatenation instead of 9 operator that is common in ordinary list concatenations.slist(Lexicographical comparison of the lists. slistEquality of sized lists is checked more efficiently due to the fact that the check on the list sizes can be done first for the constant time.  (c) 2021-2022 KowainikMPL-2.0Kowainik StablePortable Safe-Inferred"%&(/25;?ÌÑÔÜãï•#slist!Returns an empty list when given ’ or a singleton list when given “.maybeToSlist (Just 42)$Slist {sList = [42], sSize = Size 1}maybeToSlist Nothing"Slist {sList = [], sSize = Size 0}$slistReturns ’ on an empty list or “ a where a# is the first element of the slist.Examples Basic usage:slistToMaybe memptyNothingslistToMaybe (one 42)Just 42&slistToMaybe (cons 1 $ cons 2 $ one 3)Just 1Laws :  slistToMaybe . maybeToList áD id .Reverse is right only on singleton/empty lists ÏmaybeToList . slistToMaybe {empty, singleton slist} áD {empty, singleton slist} %slistTakes a slist of ”!s and returns a slist of all the “ values.7catMaybes (cons (Just 1) $ cons Nothing $ one $ Just 3)%Slist {sList = [1,3], sSize = Size 2}&slistThe ” version of • which can throw out elements.(If appliying the given function returns ’6, no element is added on to the result list. If it is “ b, then b is included in the result list.0maybeEven x = if even x then Just x else Nothings = cons 1 $ cons 2 $ one 3mapMaybe maybeEven s#Slist {sList = [2], sSize = Size 1}If we map the “1 constructor, the entire list should be returned:mapMaybe Just s'Slist {sList = [1,2,3], sSize = Size 3}'slist Similar to &/ but works with the ordinary list as the input:0maybeEven x = if even x then Just x else NothingslistWith maybeEven [1,2,3]#Slist {sList = [2], sSize = Size 1}#$%&'#$%&'(c) 2021-2022 KowainikMPL-2.0Kowainik StablePortable Safe-Inferred"%&(/25;?ÌÑÔÜãïÃ(slistO(n) . Returns a  ? of all values of the map in the ascending order of their keys.)slistO(n) . Returns a  / of all keys of the map in the ascending order.*slistO(n) . Returns a  È of all key-value pairs of the map in the ascending order of their keys.+slistO(n) . Returns a  3 of all elements of the set in the ascending order.()*+()*+Ä(c) 2019-2020 Veronika Romashkina (c) 2020-2022 KowainikMPL-2.0Kowainik StablePortable Safe-Inferred"%&(/25;?ÌÑÔÚÜãïž"à,slistÞReturns an infinite slist of repeated applications of the given function to the start element: %iterate f x == [x, f x, f (f x), ...] >> iterate (+1) 0 Slist {sList = [0..], sSize = } take 5 $ iterate ('a':) "a"?Slist {sList = ["a","aa","aaa","aaaa","aaaaa"], sSize = Size 5}Note: –à is lazy, potentially leading to thunk build-up if the consumer doesn't force each iterate. See -' for a strict variant of this function.-slistÞReturns an infinite slist of repeated applications of the given function to the start element: &iterate' f x == [x, f x, f (f x), ...] >> iterate' (+1) 0 Slist {sList = [0..], sSize = } take 5 $ iterate' ('a':) "a"?Slist {sList = ["a","aa","aaa","aaaa","aaaaa"], sSize = Size 5}- is the strict version of ,.ãIt ensures that the result of each application of force to weak head normal form before proceeding..slistO(1)Ä. Creates an infinite slist with the given element at each position. >>  repeat 42% Slist {sList = [42, 42 ..], sSize = } take 6 $ repeat 'm'(Slist {sList = "mmmmmm", sSize = Size 6}/slistO(n)?. Creates a finite slist with the given value at each position.replicate 3 'o'%Slist {sList = "ooo", sSize = Size 3}replicate (-11) "hmm""Slist {sList = [], sSize = Size 0}0slistŒTies a finite list into a circular one, or equivalently, the infinite repetition of the original list. It is the identity on infinite lists.take 23 $ cycle (slist "pam "):Slist {sList = "pam pam pam pam pam pam", sSize = Size 23} >> cycle $  [1..] Slist {sList = [1..], sSize = } 1slistO(1). An slist equivalent of — function or  [from..to] notation: creates an  , of sequentially ordered values starting at from and ending at to inclusively. fromRange 0 5-Slist {sList = [0,1,2,3,4,5], sSize = Size 6} fromRange 5 0"Slist {sList = [], sSize = Size 0} fromRange 0 0#Slist {sList = [0], sSize = Size 1}fromRange 'a' 'd'&Slist {sList = "abcd", sSize = Size 4}2slistO(1)8. Extracts the first element of a slist. Uses not total ˜ function, so use wisely.It is recommended to use 3 instead.head $ slist "qwerty"'q'head $ infiniteSlist [1..]1 head mempty'*** Exception: Prelude.head: empty list3slistO(1)4. Extracts the first element of a slist if possible.safeHead $ slist "qwerty"Just 'q'safeHead $ infiniteSlist [1..]Just 1safeHead memptyNothing4slistO(n)6. Extracts the last element of a list. Uses not total ™ function, so use wisely.It is recommended to use 5 insteadlast $ slist "qwerty"'y' last mempty'*** Exception: Prelude.last: empty list >> last $ infiniteSlist [1..] <hangs> 5slistO(n)2. Extracts the last element of a list if possible.safeLast $ slist "qwerty"Just 'y'safeLast memptyNothingsafeLast $ infiniteSlist [1..]Nothing6slistO(1)È. Returns a slist with all the elements after the head of a given slist. tail mempty"Slist {sList = [], sSize = Size 0}tail $ slist "Hello"&Slist {sList = "ello", sSize = Size 4} >> tail $  [0..] Slist {sList = [1..], sSize = } 7slistO(n)8. Return all the elements of a list except the last one. init mempty"Slist {sList = [], sSize = Size 0}init $ slist "Hello"&Slist {sList = "Hell", sSize = Size 4} >> init $  [0..] Slist {sList = [0..], sSize = } 8slistStrict version of the   appending operator ‘.9slistO(1). Strict version of the , function (in terms of the size evaluation).$The following property is preserved:   (9 x xs) ==  xs + 1  Examples:cons' 'a' $ one 'b'$Slist {sList = "ab", sSize = Size 2} >>  cons' 0 $  [1..] Slist {sList = [0..], sSize = } :slistO(1)Ì. Decomposes a slist into its head and tail. If the slist is empty, returns ’. uncons memptyNothinguncons $ one 'a'-Just ('a',Slist {sList = "", sSize = Size 0}) >>  uncons $  [0..]( Just (0, Slist {sList = [1..], sSize = }) ;slistO(n)5. Returns the elements of the slist in reverse order.reverse $ slist "Hello"'Slist {sList = "olleH", sSize = Size 5}reverse $ slist "wow"%Slist {sList = "wow", sSize = Size 3}Note: ;0 slist can not be calculated on infinite slists. >>  reverse $  [1..] <hangs> Use < to not hang on infinite slists.<slistO(n)ã. Returns the elements of the slist in reverse order. On infinite slists returns the initial slist.safeReverse $ slist "Hello"'Slist {sList = "olleH", sSize = Size 5} >>  reverse $  [1..] Slist {sList = [1..], sSize = } =slistO(n)Ý. Takes an element and a list and intersperses that element between the elements of the list.intersperse ',' $ slist "abcd")Slist {sList = "a,b,c,d", sSize = Size 7}intersperse '!' mempty"Slist {sList = "", sSize = Size 0} >> intersperse 0 $  [1,1..]% Slist {sList = [1,0,1,0..], sSize = } >slistO(n)Ì. Inserts the given slist in between the slists and concatenates the result. ,intercalate x xs = concat (intersperse x xs)Îintercalate (slist ", ") $ slist [slist "Lorem", slist "ipsum", slist "dolor"]6Slist {sList = "Lorem, ipsum, dolor", sSize = Size 19}?slistO(n * m)/. Transposes the rows and columns of the slist.transpose $ slist [slist [1,2]]éSlist {sList = [Slist {sList = [1], sSize = Size 1},Slist {sList = [2], sSize = Size 1}], sSize = Size 2} >> 0transpose $ slist [slist [1,2,3], slist [4,5,6]]Ò Slist { sList = [ Slist {sList = [1,4], sSize = Size 2} , Slist {sList = [2,5], sSize = Size 2} , Slist {sList = [3,6], sSize = Size 2} ] , sSize = Size 3 } ÔIf some of the rows are shorter than the following rows, their elements are skipped:5transpose $ slist [slist [10,11], slist [20], mempty]îSlist {sList = [Slist {sList = [10,20], sSize = Size 2},Slist {sList = [11], sSize = Size 1}], sSize = Size 2}ÛIf some of the rows is an infinite slist, then the resulting slist is going to be infinite.@slistO(2 ^ n)7. Returns the list of all subsequences of the argument.subsequences memptyÄSlist {sList = [Slist {sList = [], sSize = Size 0}], sSize = Size 1}subsequences $ slist "ab"±Slist {sList = [Slist {sList = "", sSize = Size 0},Slist {sList = "a", sSize = Size 1},Slist {sList = "b", sSize = Size 1},Slist {sList = "ab", sSize = Size 2}], sSize = Size 4}+take 4 $ subsequences $ infiniteSlist [1..]²Slist {sList = [Slist {sList = [], sSize = Size 0},Slist {sList = [1], sSize = Size 1},Slist {sList = [2], sSize = Size 1},Slist {sList = [1,2], sSize = Size 2}], sSize = Size 4}AslistO(n!)7. Returns the list of all permutations of the argument.permutations memptyÄSlist {sList = [Slist {sList = [], sSize = Size 0}], sSize = Size 1}permutations $ slist "abc"…Slist {sList = [Slist {sList = "abc", sSize = Size 3},Slist {sList = "bac", sSize = Size 3},Slist {sList = "cba", sSize = Size 3},Slist {sList = "bca", sSize = Size 3},Slist {sList = "cab", sSize = Size 3},Slist {sList = "acb", sSize = Size 3}], sSize = Size 6}Bslist O(\sum n_i) À The concatenation of all the elements of a container of slists.1concat [slist [1,2], slist [3..5], slist [6..10]]7Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10} >> concat $ slist [slist [1,2],  [3..]] Slist {sList = [1..], sSize = } Cslist O(\sum n_i) À The concatenation of all the elements of a container of slists.The strict version of B.2concat' [slist [1,2], slist [3..5], slist [6..10]]7Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10} >> concat' $ slist [slist [1,2],  [3..]] Slist {sList = [1..], sSize = } DslistÛMaps a function over all the elements of a container and concatenates the resulting slists.concatMap one "abc"%Slist {sList = "abc", sSize = Size 3}EslistÛMaps a function over all the elements of a container and concatenates the resulting slists.Strict version of D.concatMap' one "abc"%Slist {sList = "abc", sSize = Size 3}FslistO(n) . Similar to šÁ, but returns a slist of successive reduced values from the left: Îscanl f z $ slist [x1, x2, ...] == slist [z, z `f` x1, (z `f` x1) `f` x2, ...] Note that $last (scanl f z xs) == foldl f z xs.ãThis peculiar arrangement is necessary to prevent scanl being rewritten in its own right-hand side.scanl (+) 0 $ slist [1..10]?Slist {sList = [0,1,3,6,10,15,21,28,36,45,55], sSize = Size 11}GslistO(n)%. A strictly accumulating version of FHslistO(n). H is a variant of F% that has no starting value argument:  if b == 0 then Nothing else Just (b, b-1)) 107Slist {sList = [10,9,8,7,6,5,4,3,2,1], sSize = Size 10}Lslist O(i) | i < n and O(1) | otherwise.ÂReturns the prefix of the slist of the given length. If the given i: is non-positive then the empty structure is returned. If iÆ is exceeds the length of the structure the initial slist is returned.take 5 $ slist "Hello world!"'Slist {sList = "Hello", sSize = Size 5}take 20 $ slist "small"'Slist {sList = "small", sSize = Size 5}take 0 $ slist "none""Slist {sList = "", sSize = Size 0}take (-11) $ slist "hmm""Slist {sList = "", sSize = Size 0}take 4 $ infiniteSlist [1..])Slist {sList = [1,2,3,4], sSize = Size 4}Mslist O(i) | i < n and O(1) | otherwise.0Returns the suffix of the slist after the first i elements. If iÊ exceeds the length of the slist then the empty structure is returned. If i3 is non-positive the initial structure is returned.drop 6 $ slist "Hello World"'Slist {sList = "World", sSize = Size 5}drop 42 $ slist "oops!""Slist {sList = "", sSize = Size 0}drop 0 $ slist "Hello World!"/Slist {sList = "Hello World!", sSize = Size 12}drop (-4) $ one 42$Slist {sList = [42], sSize = Size 1} >>  drop 5 $  [1..] Slist {sList = [6..], sSize = } Nslist O(i) | i < n and O(1) | otherwise.ÿReturns a tuple where the first element is the prefix of the given length and the second element is the remainder of the slist. splitAt 5 $ slist "Hello World!"Ó(Slist {sList = "Hello", sSize = Size 5},Slist {sList = " World!", sSize = Size 7})splitAt 0 $ slist "abc"Ê(Slist {sList = "", sSize = Size 0},Slist {sList = "abc", sSize = Size 3})splitAt 4 $ slist "abc"Ê(Slist {sList = "abc", sSize = Size 3},Slist {sList = "", sSize = Size 0})splitAt (-42) $ slist "??"É(Slist {sList = "", sSize = Size 0},Slist {sList = "??", sSize = Size 2}) >>  splitAt 2 $  [1..] (Slist {sList = [1,2], sSize = # 2}, Slist {sList = [3..], sSize = }) OslistO(n)Û. Returns the longest prefix (possibly empty) of elements that satisfy the given predicate.takeWhile (<3) $ slist [1..10]%Slist {sList = [1,2], sSize = Size 2}$takeWhile (<3) $ infiniteSlist [1..]%Slist {sList = [1,2], sSize = Size 2} takeWhile (<=10) $ slist [1..10]7Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10}takeWhile (<0) $ slist [1..10]"Slist {sList = [], sSize = Size 0}PslistO(n)ù. Returns the suffix (possibly empty) of the remaining elements after dropping elements that satisfy the given predicate.dropWhile (<3) $ slist [1..10]2Slist {sList = [3,4,5,6,7,8,9,10], sSize = Size 8} dropWhile (<=10) $ slist [1..10]"Slist {sList = [], sSize = Size 0}dropWhile (<0) $ slist [1..10]7Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10}-take 5 $ dropWhile (<3) $ infiniteSlist [1..]+Slist {sList = [3,4,5,6,7], sSize = Size 5} >> dropWhile (< 5) $  [1..]! Slist {sList = [5,6..], sSize = } QslistO(n)³. Returns a tuple where first element is longest prefix (possibly empty) of the slist of elements that satisfy the given predicate and second element is the remainder of the list.#span (<3) $ slist [1,2,3,4,1,2,3,4]Õ(Slist {sList = [1,2], sSize = Size 2},Slist {sList = [3,4,1,2,3,4], sSize = Size 6})span (<=10) $ slist [1..3]Ì(Slist {sList = [1,2,3], sSize = Size 3},Slist {sList = [], sSize = Size 0})span (<0) $ slist [1..3]Ì(Slist {sList = [], sSize = Size 0},Slist {sList = [1,2,3], sSize = Size 3}) >>  span (<3) $  [1..]Ç (Slist {sList = [1,2], sSize = Size 2}, Slist {sList = [3..], sSize = }) RslistO(n)è. Returns a tuple where first element is longest prefix (possibly empty) of the slist of elements that do notÍ satisfy the given predicate and second element is the remainder of the list.  > break p = Q (œ . p) SslistO(n) . Splits a  ‚ into components of the given length. The last element may be shorter than the other chunks, depending on the length of the input.chunksOf 3 $ slist [0..7]—Slist {sList = [Slist {sList = [0,1,2], sSize = Size 3},Slist {sList = [3,4,5], sSize = Size 3},Slist {sList = [6,7], sSize = Size 2}], sSize = Size 3}chunksOf 0 $ slist [0..10]"Slist {sList = [], sSize = Size 0}chunksOf (-13) $ slist [0..10]"Slist {sList = [], sSize = Size 0}chunksOf 100 $ slist [1,2,3]ÉSlist {sList = [Slist {sList = [1,2,3], sSize = Size 3}], sSize = Size 1})take 2 $ chunksOf 3 $ infiniteSlist [1..]ñSlist {sList = [Slist {sList = [1,2,3], sSize = Size 3},Slist {sList = [4,5,6], sSize = Size 3}], sSize = Size 2}TslistO(n)‘. Splits a list into components of the given length. The last element may be shorter than the other chunks, depending on the length of the input.listChunksOf 3 [0..7][[0,1,2],[3,4,5],[6,7]]listChunksOf 0 [0..10][]listChunksOf (-13) [0..10][]listChunksOf 100 [1,2,3] [[1,2,3]]P.take 2 $ listChunksOf 3 [1..][[1,2,3],[4,5,6]]UslistO(m)1. Drops the given prefix from a list. It returns ’6 if the slist did not start with the given prefix, or “( the slist after the prefix, if it does.*stripPrefix (slist "foo") (slist "foobar"),Just (Slist {sList = "bar", sSize = Size 3})'stripPrefix (slist "foo") (slist "foo"))Just (Slist {sList = "", sSize = Size 0})*stripPrefix (slist "foo") (slist "barfoo")Nothing!stripPrefix mempty (slist "foo"),Just (Slist {sList = "foo", sSize = Size 3})7stripPrefix (infiniteSlist [0..]) (infiniteSlist [1..])NothingNote:1 this function could hang on the infinite slists. >> 7stripPrefix (infiniteSlist [1..]) (infiniteSlist [1..]) <hangs> Use V instead.Vslist Similar to U0, but never hangs on infinite lists and returns ’ in that case.;safeStripPrefix (infiniteSlist [1..]) (infiniteSlist [1..])Nothing;safeStripPrefix (infiniteSlist [0..]) (infiniteSlist [1..])NothingWslistO(n)´. Takes a slist and returns a slist of slists such that the concatenation of the result is equal to the argument. Moreover, each sublist in the result contains only equal elements.It is a special case of X1, which allows to supply their own equality test.group $ slist "Mississippi"ÄSlist {sList = [Slist {sList = "M", sSize = Size 1},Slist {sList = "i", sSize = Size 1},Slist {sList = "ss", sSize = Size 2},Slist {sList = "i", sSize = Size 1},Slist {sList = "ss", sSize = Size 2},Slist {sList = "i", sSize = Size 1},Slist {sList = "pp", sSize = Size 2},Slist {sList = "i", sSize = Size 1}], sSize = Size 8} group mempty"Slist {sList = [], sSize = Size 0}XslistO(n) . Non-overloaded version of the W function.!groupBy (>) $ slist "Mississippi"þSlist {sList = [Slist {sList = "M", sSize = Size 1},Slist {sList = "i", sSize = Size 1},Slist {sList = "s", sSize = Size 1},Slist {sList = "si", sSize = Size 2},Slist {sList = "s", sSize = Size 1},Slist {sList = "sippi", sSize = Size 5}], sSize = Size 6}YslistO(n)?. Returns all initial segments of the argument, shortest first.inits $ slist "abc"³Slist {sList = [Slist {sList = "", sSize = Size 0},Slist {sList = "a", sSize = Size 1},Slist {sList = "ab", sSize = Size 2},Slist {sList = "abc", sSize = Size 3}], sSize = Size 4} inits memptyÄSlist {sList = [Slist {sList = [], sSize = Size 0}], sSize = Size 1}ZslistO(n)=. Returns all final segments of the argument, shortest first.tails $ slist "abc"³Slist {sList = [Slist {sList = "abc", sSize = Size 3},Slist {sList = "bc", sSize = Size 2},Slist {sList = "c", sSize = Size 1},Slist {sList = "", sSize = Size 0}], sSize = Size 4} tails memptyÄSlist {sList = [Slist {sList = [], sSize = Size 0}], sSize = Size 1}[slistO(m). Takes two slists and returns / iff the first slist is a prefix of the second.1isPrefixOf (slist "Hello") (slist "Hello World!")True1isPrefixOf (slist "Hello World!") (slist "Hello")FalseisPrefixOf mempty (slist "hey")TrueNote:1 this function could hang on the infinite slists. >> 6isPrefixOf (infiniteSlist [1..]) (infiniteSlist [1..]) <hangs> Use \ instead.\slist Similar to [0, but never hangs on infinite lists and returns ž in that case.:safeIsPrefixOf (infiniteSlist [1..]) (infiniteSlist [1..])False:safeIsPrefixOf (infiniteSlist [0..]) (infiniteSlist [1..])False]slistTakes two slists and returns / iff the first slist is a suffix of the second.2isSuffixOf (slist "World!") (slist "Hello World!")True1isSuffixOf (slist "Hello World!") (slist "Hello")FalseisSuffixOf mempty (slist "hey")TrueNote:5 this function hangs if the second slist is infinite. >>  isSuffixOf anything (infiniteSlist [1..]) <hangs> Use ^ instead.^slist Similar to ]0, but never hangs on infinite lists and returns ž in that case.2safeIsSuffixOf (slist [1,2]) (infiniteSlist [1..])False:safeIsSuffixOf (infiniteSlist [1..]) (infiniteSlist [1..])False_slistTakes two slists and returns Ñ iff the first slist is contained, wholly and intact, anywhere within the second.-isInfixOf (slist "ll") (slist "Hello World!")True*isInfixOf (slist " Hello") (slist "Hello")False0isInfixOf (slist "Hello World!") (slist "Hello")FalseNote:1 this function could hang on the infinite slists. >> 6isPrefixOf (infiniteSlist [1..]) (infiniteSlist [1..]) <hangs> Use ` instead.`slist Similar to _0, but never hangs on infinite lists and returns ž in that case.9safeIsInfixOf (infiniteSlist [1..]) (infiniteSlist [1..])False9safeIsInfixOf (infiniteSlist [0..]) (infiniteSlist [1..])FalseaslistTakes two slists and returns ø if all the elements of the first slist occur, in order, in the second. The elements do not have to occur consecutively.isSubsequenceOf x y is equivalent to Ÿ x (@ y).4isSubsequenceOf (slist "Hll") (slist "Hello World!")True1isSubsequenceOf (slist "") (slist "Hello World!")True6isSubsequenceOf (slist "Hallo") (slist "Hello World!")FalseNote:5 this function hangs if the second slist is infinite. >>  isSuffixOf anything (infiniteSlist [1..]) <hangs> Use ^ instead.bslist Similar to a0, but never hangs on infinite lists and returns ž in that case.?safeIsSubsequenceOf (infiniteSlist [1..]) (infiniteSlist [1..])False?safeIsSubsequenceOf (infiniteSlist [0..]) (infiniteSlist [1..])FalsecslistO(n)<. Looks up by the given key in the slist of key-value pairs.,lookup 42 $ slist $ [(1, "one"), (2, "two")]Nothing×lookup 42 $ slist $ [(1, "one"), (2, "two"), (42, "life, the universe and everything")](Just "life, the universe and everything";lookup 1 $ zip (infiniteSlist [1..]) (infiniteSlist [0..])Just 0dslistO(n)Å. Returns the slist of the elements that satisfy the given predicate.filter (<3) $ slist [1..5]%Slist {sList = [1,2], sSize = Size 2})take 5 $ filter odd $ infiniteSlist [1..]+Slist {sList = [1,3,5,7,9], sSize = Size 5}eslistO(n)Ù. Returns the pair of slists of elements which do and do not satisfy the given predicate.partition (<3) $ slist [1..5]Ï(Slist {sList = [1,2], sSize = Size 2},Slist {sList = [3,4,5], sSize = Size 3})fslistO(n)6. Returns the pair of slists of elements resulting to   and resulting to ¡ by applying the given function.ÀonEven x = if even x then Right x else Left ("Oops: " ++ show x)#partitionWith onEven $ slist [1..5]ç(Slist {sList = ["Oops: 1","Oops: 3","Oops: 5"], sSize = Size 3},Slist {sList = [2,4], sSize = Size 2})gslistO(n)5. Returns the pair of lists of elements resulting to   and resulting to ¡ by applying the given function.ÀonEven x = if even x then Right x else Left ("Oops: " ++ show x)listPartitionWith onEven [1..5]'(["Oops: 1","Oops: 3","Oops: 5"],[2,4])hslist O(i) | i < n and O(1) | otherwise.?Returns the element of the slist at the given position. If the i6 exceeds the length of the slist the function returns ’.let sl = slist [1..10]at 0 slJust 1 at (-1) slNothingat 11 slNothingat 9 slJust 10islist O(min i n). Unsafe version of the hã function. If the element on the given position does not exist it throws the exception at run-time.let sl = slist [1..10] unsafeAt 0 sl1unsafeAt (-1) sl)*** Exception: Prelude.!!: negative indexunsafeAt 11 sl**** Exception: Prelude.!!: index too large unsafeAt 9 sl10jslistO(n)Ï. Returns the index of the first element in the given slist which is equal (by ¢) to the query element, or ’ if there is no such element.elemIndex 5 $ slist [1..10]Just 4elemIndex 0 $ slist [1..10]NothingkslistO(n) . Extends jÚ, by returning the indices of all elements equal to the query element, in ascending order.+elemIndices 1 $ slist [1,1,1,2,2,4,5,1,9,1]+Slist {sList = [0,1,2,7,9], sSize = Size 5}!take 5 $ elemIndices 1 $ repeat 1+Slist {sList = [0,1,2,3,4], sSize = Size 5}lslistO(n)Ù. Returns the index of the first element in the slist satisfying the given predicate, or ’ if there is no such element.findIndex (>3) $ slist [1..5]Just 3findIndex (<0) $ slist [1..5]NothingmslistO(n) . Extends lÞ, by returning the indices of all elements satisfying the given predicate, in ascending order.findIndices (<3) $ slist [1..5]%Slist {sList = [0,1], sSize = Size 2}findIndices (<0) $ slist [1..5]"Slist {sList = [], sSize = Size 0}1take 5 $ findIndices (<=10) $ infiniteSlist [1..]+Slist {sList = [0,1,2,3,4], sSize = Size 5}nslist O(min n m)>. Takes two slists and returns a slist of corresponding pairs.(zip (slist [1,2]) (slist ["one", "two"])5Slist {sList = [(1,"one"),(2,"two")], sSize = Size 2}*zip (slist [1,2,3]) (slist ["one", "two"])5Slist {sList = [(1,"one"),(2,"two")], sSize = Size 2}1zip (slist [1,2]) (slist ["one", "two", "three"])5Slist {sList = [(1,"one"),(2,"two")], sSize = Size 2}zip mempty (slist [1..5])"Slist {sList = [], sSize = Size 0}0zip (infiniteSlist [1..]) (slist ["one", "two"])5Slist {sList = [(1,"one"),(2,"two")], sSize = Size 2}oslistO(minimum [n1, n2, n3])Â. Takes three slists and returns a slist of triples, analogous to n.pslist O(min n m). Generalises nà by zipping with the given function, instead of a tupling function. For example,  zipWith (+)à is applied to two lists to produce the list of corresponding sums.qslistO(minimum [n1, n2, n3])Œ. Takes a function which combines three elements, as well as three slists and returns a slist of their point-wise combination, analogous to p.rslistO(n)à. Transforms a slist of pairs into a slist of first components and a slist of second components.#unzip $ slist [(1,"one"),(2,"two")]Õ(Slist {sList = [1,2], sSize = Size 2},Slist {sList = ["one","two"], sSize = Size 2})sslistO(n)Â. Takes a slist of triples and returns three slists, analogous to r.tslistO(n^2)í. Removes duplicate elements from a slist. In particular, it keeps only the first occurrence of each element.It is a special case of u0, which allows to supply your own equality test.nub $ replicate 5 'a'#Slist {sList = "a", sSize = Size 1} nub mempty"Slist {sList = [], sSize = Size 0}#nub $ slist [1,2,3,4,3,2,1,2,4,3,5]+Slist {sList = [1,2,3,4,5], sSize = Size 5}uslistO(n^2). Behaves just like tÎ, except it uses a user-supplied equality predicate instead of the overloaded ¢ function.6nubBy (\x y -> mod x 3 == mod y 3) $ slist [1,2,4,5,6]'Slist {sList = [1,2,6], sSize = Size 3}vslistÙRemoves duplicate elements from a slist, keeping only the first occurance of the element.Like t but runs in  O(n \log n)  time and requires £.%ordNub $ slist [3, 3, 3, 2, 2, -1, 1]*Slist {sList = [3,2,-1,1], sSize = Size 4}wslistO(n)Ì. Removes the first occurrence of the given element from its slist argument.delete 'h' $ slist "hahaha"'Slist {sList = "ahaha", sSize = Size 5}delete 0 $ slist [1..3]'Slist {sList = [1,2,3], sSize = Size 3}xslistO(n). Behaves like w/, but takes a user-supplied equality predicate.deleteBy (>=) 4 $ slist [1..10]4Slist {sList = [2,3,4,5,6,7,8,9,10], sSize = Size 9}yslistO(n*m)…. Takes a predicate and two slists and returns the first slist with the first occurrence of each element of the second slist removed.7deleteFirstsBy (==) (slist [1..5]) (slist [2,8,4,10,1])%Slist {sList = [3,5], sSize = Size 2}zslistO(n*m)à. Returns the difference between two slists. The operation is non-associative. In the result of  diff xs ys*, the first occurrence of each element of ys( in turn (if any) has been removed from xs. Thus diff (xs <> ys) ys == xs&diff (slist [1..10]) (slist [1,3..10]),Slist {sList = [2,4,6,8,10], sSize = Size 5}(diff (slist [1,3..10]) (slist [2,4..10])+Slist {sList = [1,3,5,7,9], sSize = Size 5}{slistO(n*m)+. Returns the list union of the two slists.#union (slist "pen") (slist "apple")'Slist {sList = "penal", sSize = Size 5}“Duplicates, and elements of the first slist, are removed from the the second slist, but if the first slist contains duplicates, so will the result.#union (slist "apple") (slist "pen")(Slist {sList = "applen", sSize = Size 6}It is a special case of |.|slistO(n*m). Non-overloaded version of {.}slistO(n*m)/. Returns the slist intersection of two slists.-intersect (slist [1,2,3,4]) (slist [2,4,6,8])%Slist {sList = [2,4], sSize = Size 2}:If the first list contains duplicates, so will the result./intersect (slist [1,2,2,3,4]) (slist [6,4,4,2])'Slist {sList = [2,2,4], sSize = Size 3}6If the first slist is infinite, so will be the result.îIf the element is found in both the first and the second slist, the element from the first slist will be used.It is a special case of ~.~slistO(n*m). Non-overloaded version of }.slist O(n log n)Á. implements a stable sorting algorithm. It is a special case of €.îElements are arranged from from lowest to highest, keeping duplicates in the order they appeared in the input.sort $ slist [10, 9..1]7Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10}Note:( this function hangs on infinite slists.€slist O(n log n). Non-overloaded version of .ÓsortBy (\(a,_) (b,_) -> compare a b) $ slist [(2, "world"), (4, "!"), (1, "Hello")]ÁSlist {sList = [(1,"Hello"),(2,"world"),(4,"!")], sSize = Size 3}Note:( this function hangs on infinite slists.slist O(n log n)Ô. Sorts a list by comparing the results of a key function applied to each element. sortOn f is equivalent to € (comparing f)7, but has the performance advantage of only evaluating fú once for each element in the input list. This is called the decorate-sort-undecorate paradigm, or Schwartzian transform.éElements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input.9sortOn fst $ slist [(2, "world"), (4, "!"), (1, "Hello")]ÁSlist {sList = [(1,"Hello"),(2,"world"),(4,"!")], sSize = Size 3}Note:( this function hangs on infinite slists.‚slist O(n log n)Ò. Sorts a list by comparing the results of a key function applied to each element.éElements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input.;sortWith fst $ slist [(2, "world"), (4, "!"), (1, "Hello")]ÁSlist {sList = [(1,"Hello"),(2,"world"),(4,"!")], sSize = Size 3}ƒslistO(n)þ. Takes an element and a slist and inserts the element into the slist at the first position where it is less than or equal to the next element. In particular, if the list is sorted before the call, the result will also be sorted. It is a special case of „.insert 4 $ slist [1,2,3,5,6]-Slist {sList = [1,2,3,4,5,6], sSize = Size 6}„slistO(n) . The non-overloaded version of ƒ.…slistO(1). The …& function is an overloaded version of ). In particular, instead of returning an ., it returns any type which is an instance of ¤.genericLength $ one 421genericLength $ slist [1..3]3#genericLength $ infiniteSlist [1..]9223372036854775807†slist O(i) | i < n and O(1) | otherwise. The †& function is an overloaded version of L, which accepts any ¥) value as the number of elements to take.$genericTake 5 $ slist "Hello world!"'Slist {sList = "Hello", sSize = Size 5}genericTake 20 $ slist "small"'Slist {sList = "small", sSize = Size 5}genericTake 0 $ slist "none""Slist {sList = "", sSize = Size 0}genericTake (-11) $ slist "hmm""Slist {sList = "", sSize = Size 0}#genericTake 4 $ infiniteSlist [1..])Slist {sList = [1,2,3,4], sSize = Size 4}‡slist O(i) | i < n and O(1) | otherwise. The ‡& function is an overloaded version of M, which accepts any ¥) value as the number of elements to drop.#genericDrop 6 $ slist "Hello World"'Slist {sList = "World", sSize = Size 5}genericDrop 42 $ slist "oops!""Slist {sList = "", sSize = Size 0}$genericDrop 0 $ slist "Hello World!"/Slist {sList = "Hello World!", sSize = Size 12}genericDrop (-4) $ one 42$Slist {sList = [42], sSize = Size 1} >>  drop 5 $  [1..] Slist {sList = [6..], sSize = } ˆslist O(i) | i < n and O(1) | otherwise. The ˆ& function is an overloaded version of N, which accepts any ¥) value as the position at which to split.'genericSplitAt 5 $ slist "Hello World!"Ó(Slist {sList = "Hello", sSize = Size 5},Slist {sList = " World!", sSize = Size 7})genericSplitAt 0 $ slist "abc"Ê(Slist {sList = "", sSize = Size 0},Slist {sList = "abc", sSize = Size 3})genericSplitAt 4 $ slist "abc"Ê(Slist {sList = "abc", sSize = Size 3},Slist {sList = "", sSize = Size 0})!genericSplitAt (-42) $ slist "??"É(Slist {sList = "", sSize = Size 0},Slist {sList = "??", sSize = Size 2}) >> genericSplitAt 2 $  [1..] (Slist {sList = [1,2], sSize = # 2}, Slist {sList = [3..], sSize = }) ‰slist O(i) | i < n and O(1) | otherwise. The ‰& function is an overloaded version of h, which accepts any ¥Û value as the position. If the element on the given position does not exist it will return ’.let sl = slist [1..10]genericAt 0 slJust 1genericAt (-1) slNothinggenericAt 11 slNothinggenericAt 9 slJust 10Šslist O(min i n). The Š& function is an overloaded version of i, which accepts any ¥ð value as the position. If the element on the given position does not exist it throws the exception at run-time.let sl = slist [1..10]genericUnsafeAt 0 sl1genericUnsafeAt (-1) sl7*** Exception: Slist.genericUnsafeAt: negative argumentgenericUnsafeAt 11 sl5*** Exception: Slist.genericUnsafeAt: index too largegenericUnsafeAt 9 sl10‹slistO(n). The ‹& function is an overloaded version of /, which accepts any ¥, value as the number of repetitions to make.genericReplicate 3 'o'%Slist {sList = "ooo", sSize = Size 3}genericReplicate (-11) "hmm""Slist {sList = [], sSize = Size 0}ó #$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ó ,-./0123457689:;<=>?@ABCDEFGHIJKLMNOPQRUVWXYZST[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹#$%&'()*+¦      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–‘—˜‘—™‘—š‘›œ‘ž‘Ÿ‘ ‘›‘¡1‘’¢‘¡7‘¡9‘—£‘—¤”¥¦”•§”•¨‘—©‘ª«‘ª¬”¥­”¥®‘¯°‘±²³$slist-0.2.0.1-GF8MvDjpXdKB5STszjn8Te Slist.Size Slist.Type Slist.MaybeSlist.ContainersSlistL++SizeInfinitysizes $fBoundedSize $fNumSize $fShowSize $fReadSize$fEqSize $fOrdSizesListsSizeslist infiniteSlistonelensizeisEmptyconsmap $fIsListSlist$fTraversableSlist$fFoldableSlist $fMonadSlist$fAlternativeSlist$fApplicativeSlist$fFunctorSlist $fMonoidSlist$fSemigroupSlist $fOrdSlist $fEqSlist $fShowSlist $fReadSlist maybeToSlist slistToMaybe catMaybesmapMaybe slistWith mapToVals mapToKeys mapToPairs setToSlistiterateiterate'repeat replicatecycle fromRangeheadsafeHeadlastsafeLasttailinitappend'cons'unconsreverse safeReverse intersperse intercalate transpose subsequences permutationsconcatconcat' concatMap concatMap'scanlscanl'scanl1scanrscanr1unfoldrtakedropsplitAt takeWhile dropWhilespanbreakchunksOf listChunksOf stripPrefixsafeStripPrefixgroupgroupByinitstails isPrefixOfsafeIsPrefixOf isSuffixOfsafeIsSuffixOf isInfixOf safeIsInfixOfisSubsequenceOfsafeIsSubsequenceOflookupfilter partition partitionWithlistPartitionWithatunsafeAt elemIndex elemIndices findIndex findIndiceszipzip3zipWithzipWith3unzipunzip3nubnubByordNubdeletedeleteBydeleteFirstsBydiffunionunionBy intersect intersectBysortsortBysortOnsortWithinsertinsertBy genericLength genericTake genericDropgenericSplitAt genericAtgenericUnsafeAtgenericReplicatebaseGHC.EnummaxBoundghc-prim GHC.TypesInt Data.FoldablesumproductlengthGHC.Base<> GHC.MaybeNothingJustMaybeGHC.List enumFromTofoldlfoldr GHC.ClassesnotTrueFalseelem Data.EitherLeftRight==OrdGHC.NumNumGHC.RealIntegral