Îõ³h& ð Ì(c) OleksandrZhabenko 2020-2023MIToleksandr.zhabenko@yahoo.com Experimental Safe-InferredÂÊ ½ mmsyn2-arrayÄThe function that can be used instead of the 'case ... of' function Ö case var of { a1 -> b1 ; a2 -> b2 ; a3 -> b3 ; ... ; an -> bn ; ~z -> defaultValue } „ If we follow a lot of teaching materials that explain the workflow of the construction we think that the complexity of it is about O(n) for the transformation of a to b£ here. David Feuer (david.feuer (at) gmail.com) said that 'case ... of' is already optimized in GHC. Some benchmarks show that its behaviour tends to be about of O(log n)/ complexity, the same as the proposed function À. Nevertheless, the last one shows better performance in some situations, is rather general and can be used for another data representation. Therefore, it can be preferred in some situations. % uses binary search algorithm and an  of (a, b)» as somewhat like a complicated filter or like a special sieve. The array must be sorted in ascending order here for the algorithm to be used correctly. For this you can use the function Ø or the similar ones. If you would like to use them both, please, consider usage of the  or  instead. The function  is used internally in the à that is recommended to be used in most cases. Nevertheless, it is provided here if you have precomputed the first two arguments or at least some parts of them so that you can reduce the needed amount of computations in the . mmsyn2-array0The meaning of the arguments is the same as for . Is used internally in it.  mmsyn2-array5A generally written without extending variant of the . mmsyn2-array‚If the list argument is sorted in the ascending order by the first element in every tuple, then to reduce computations instead of ? \def xs x -> getBFst' (def, listArray (0,length xs - 1) xs) x  you can use this function. mmsyn2-array±If it is unknown whether the list argument is sorted in the ascending order by the first element in every tuple (or, definitely, it is not, speaking generally), then instead of Î \def xs x -> getBFst' (def, listArray (0,length xs - 1) . sortOn fst $ xs) x  you can use this function. mmsyn2-array¡Sorts the list of pairs by the first element in the tuples, then transforms them into an immutable array. Can be used only if the list contains no more than 2^31 - 1 elements though this is not checked, it is up to user to check this constraint before or provide its correctness by design. mmsyn2-arrayÂThe first unboxed tuple of the index and the element of the array. mmsyn2-arrayÃThe second unboxed tuple of the index and the element of the array. mmsyn2-array‚The array of the pairs of the compared value and the result that is used in case the last argument is equal to the compared value. mmsyn2-arrayäThe default value that is used if no first element in the array tuples equals to the compared value. mmsyn2-arrayThe compared value, well, the main+ function argument, to which it is applied. mmsyn2-arrayThe resulting branch value.  +mmsyn2-array-0.3.1.1-HJ06AKCEn3dKavkOCbveZK CaseBi.Arr getBFst''getBFst'getBFstLSorted' getBFstL'listArrSortedByFstbaseGHC.ArrArraygBF3