h,       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                 2022 Julian OspaldMIT"Julian Ospald  experimentalportableNone (@ QTotal conversion to char.Y os-string O(n). Construct a new ShortByteString from a CWString. The resulting ShortByteString' is an immutable copy of the original CWString4, and is managed on the Haskell heap. The original CWString must be null terminated.Z os-string O(n). Construct a new ShortByteString from a  CWStringLen. The resulting ShortByteString& is an immutable copy of the original  CWStringLen. The ShortByteString is a normal Haskell value and will be managed on the Haskell heap.[ os-string O(n) construction. Use a ShortByteString. with a function requiring a null-terminated CWString. The CWString is a copy and will be freed automatically; it must not be stored or used after the subcomputation finishes.\ os-string O(n) construction. Use a ShortByteString with a function requiring a  CWStringLen . As for  useAsCWString, this function makes a copy of the original ShortByteString. It must not be stored or used after the subcomputation finishes.] os-string O(n) construction. Use a ShortByteString with a function requiring a  CWStringLen . As for  useAsCWString, this function makes a copy of the original ShortByteString. It must not be stored or used after the subcomputation finishes.eEncode Word16 as little-endian.g!Decode Word16 from little-endian.lGiven the maximum size needed and a function to make the contents of a ShortByteString, createAndTrim makes the . The generating function is required to return the actual final size (<= the maximum size) and the result value. The resulting byte array is realloced to this size.pReturns the length of the substring matching, not the index. If no match, returns 0.eWord8 index (not Word16)f Word8 indexgWord8 index (not Word16)tarray 1offset for array 1array 2offset for array 2length to compare like memcmp*OSqtXVkRlmnrpogfPs^_U]TYZad`cjbW[\iQheMNKL*OPQRSMNKLTUVWXYZ[\]^_`abcdefghijklmnopqrst/(c) Duncan Coutts 2012-2013, Julian Ospald 2022 BSD-stylehasufell@posteo.destableghc onlyNone $%/.=D*+,->BC?@EF !"# :;< GHA7 0132465&(') 89IJu  u !"#$%789&()'*+,-./0123456:;<=>@?A BCDEFGHIJ 2022 Julian OspaldMIT"Julian Ospald  experimentalportableNone ( Just (u,u)) cO(n), where n# is the length of the result. The 0 function is analogous to the List 'unfoldr'.  builds a ShortByteString from a seed value. The function takes the element and returns 9 if it is done producing the ShortByteString or returns  (a,b), in which case, a& is the next byte in the string, and b* is the seed value for further production.=This function is not efficient/safe. It will build a list of [Word16]) and run the generator until it returns 7, otherwise recurse infinitely, then finally create a . Examples:  unfoldr (\x -> if x <= 5 then Just (x, x + 1) else Nothing) 0 == pack [0, 1, 2, 3, 4, 5]O(n) Like ,  builds a ShortByteString from a seed value. However, the length of the result is limited by the first argument to (. This function is more efficient than 1 when the maximum length of the result is known.The following equation relates  and : ,fst (unfoldrN n f s) == take n (unfoldr f s)O(n)  n, applied to a ShortByteString xs, returns the prefix of xs of length n, or xs itself if n >  xs."Note: copies the entire byte arrayO(1)  n xs is equivalent to  ( xs - n) xs . Takes n! elements from end of bytestring./takeEnd 3 "a\NULb\NULc\NULd\NULe\NULf\NULg\NUL""e\NULf\NULg\NUL"/takeEnd 0 "a\NULb\NULc\NULd\NULe\NULf\NULg\NUL"""takeEnd 4 "a\NULb\NULc\NUL""a\NULb\NULc\NUL" Similar to  , returns the longest (possibly empty) prefix of elements satisfying the predicate.Returns the longest (possibly empty) suffix of elements satisfying the predicate. p is equivalent to  .  p . .O(n)  n xs returns the suffix of xs after the first n elements, or [] if n >  xs."Note: copies the entire byte arrayO(1)  n xs is equivalent to  ( xs - n) xs . Drops n! elements from end of bytestring./dropEnd 3 "a\NULb\NULc\NULd\NULe\NULf\NULg\NUL""a\NULb\NULc\NULd\NUL"/dropEnd 0 "a\NULb\NULc\NULd\NULe\NULf\NULg\NUL"%"a\NULb\NULc\NULd\NULe\NULf\NULg\NUL"dropEnd 4 "a\NULb\NULc\NUL""" Similar to  , drops the longest (possibly empty) prefix of elements satisfying the predicate and returns the remainder."Note: copies the entire byte array os-string  Similar to  , drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. p is equivalent to  .  p . .>Returns the longest (possibly empty) suffix of elements which do not8 satisfy the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( (not . p) &&&  (not . p)). Similar to  , returns the longest (possibly empty) prefix of elements which do not8 satisfy the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( (not . p) &&&  (not . p)). Similar to  , returns the longest (possibly empty) prefix of elements satisfying the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( p &&&  p).Returns the longest (possibly empty) suffix of elements satisfying the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( p &&&  p).We have 0spanEnd (not . isSpace) "x y z" == ("x y ", "z")and spanEnd (not . isSpace) ps == let (x, y) = span (not . isSpace) (reverse ps) in (reverse y, reverse x)O(n)  n xs is equivalent to ( n xs,  n xs).Note: copies the substringsO(n) Break a  into pieces separated by the byte argument, consuming the delimiter. I.e. split 10 "a\nb\nd\ne" == ["a","b","d","e"] -- fromEnum '\n' == 10 split 97 "aXaXaXa" == ["","X","X","X",""] -- fromEnum 'a' == 97 split 120 "x" == ["",""] -- fromEnum 'x' == 120 split undefined "" == [] -- and not [""]and 9intercalate [c] . split c == id split == splitWith . (==)Note: copies the substringsO(n) Splits a  into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg. splitWith (==97) "aabbaca" == ["","","bb","c",""] -- fromEnum 'a' == 97 splitWith undefined "" == [] -- and not [""]3Check whether one string is a substring of another., applied to a binary operator, a starting value (typically the left-identity of the operator), and a ShortByteString, reduces the ShortByteString using the binary operator, from left to right. is like  , but strict in the accumulator., applied to a binary operator, a starting value (typically the right-identity of the operator), and a ShortByteString, reduces the ShortByteString using the binary operator, from right to left. is like  , but strict in the accumulator. is a variant of  that has no starting value argument, and thus must be applied to non-empty s. An exception will be thrown in the case of an empty ShortByteString. is like , but strict in the accumulator. An exception will be thrown in the case of an empty ShortByteString. is a variant of  that has no starting value argument, and thus must be applied to non-empty s An exception will be thrown in the case of an empty ShortByteString. is a variant of $, but is strict in the accumulator.O(1) - index (subscript) operator, starting from 0. os-string O(1) & index, starting from 0, that returns  if: 0 <= n < length bs os-string O(1) & index, starting from 0, that returns  if: 0 <= n < length bsO(n)  is the  membership predicate.O(n) , applied to a predicate and a ByteString, returns a ByteString containing those characters that satisfy the predicate.O(n) The  function takes a predicate and a ByteString, and returns the first element in matching the predicate, or  if there is no such element. find f p = case findIndex f p of Just n -> Just (p ! n) ; _ -> NothingO(n) The  function takes a predicate a ByteString and returns the pair of ByteStrings with elements which do and do not satisfy the predicate, respectively; i.e., 4partition p bs == (filter p xs, filter (not . p) xs)O(n) The ? function returns the index of the first element in the given * which is equal to the query element, or  if there is no such element.O(n) The  function extends , by returning the indices of all elements equal to the query element, in ascending order.count returns the number of times its argument appears in the ShortByteStringO(n) The " function takes a predicate and a  and returns the index of the first element in the ByteString satisfying the predicate.O(n) The  function extends , by returning the indices of all elements satisfying the predicate, in ascending order.  number of number of Word16 number of  number of  number of number of Word16String to search forString to search in+Head and tail of string broken at substring number of  number of  number of  number of  number of  ;<65 ]YZ[\{|ywvz}~xvwx z{|}~y56;<YZ][\z{ Safe-Inferred=Like try , but rethrows async exceptions.NoneD Could not decode a byte sequence because it was invalid under the given encoding, or ran out of input in mid-decode.Mimics the base encoding for filesystem operations. This should be total on all inputs (word16 byte arrays).*Note that this has a subtle difference to /: it doesn't care for the 0x0000< end marker and will as such produce different results. Use takeWhile (/= 'NUL')( on the input to recover this behavior.Decode with the given .Encode with the given .This mimics the filepath decoder base uses on unix (using PEP-383), with the small distinction that we're not truncating at NUL bytes (because we're not at the outer FFI layer).This mimics the string decoder base uses on unix, with the small distinction that we're not truncating at NUL bytes (because we're not at the outer FFI layer).This mimics the filepath encoder base uses on unix (using PEP-383), with the small distinction that we're not truncating at NUL bytes (because we're not at the outer FFI layer).This mimics the string encoder base uses on unix, with the small distinction that we're not truncating at NUL bytes (because we're not at the outer FFI layer).This mimics the filepath decoder base uses on windows, with the small distinction that we're not truncating at NUL bytes (because we're not at the outer FFI layer).This mimics the filepath dencoder base uses on windows, with the small distinction that we're not truncating at NUL bytes (because we're not at the outer FFI layer).!!NoneDNone =K!Newtype representing a code unit.7On Windows, this is restricted to two-octet codepoints , on POSIX one-octet ().=Newtype representing short operating system specific strings.Internally this is either  or 1, depending on the platform. Both use unpinned ShortByteString for efficiency.%The constructor is only exported via System.OsString.Internal.Types, since dealing with the internals isn't generally recommended, but supported in case you need to write platform specific code.,Commonly used Posix string as uninterpreted char[] array.5Commonly used windows string as wide character bytes.'Just a short bidirectional synonym for  constructor.'Just a short bidirectional synonym for  constructor.'Just a short bidirectional synonym for  constructor.'Just a short bidirectional synonym for  constructor.#This is a type-level evidence that  is a newtype wrapper over  or  and  is a newtype wrapper over  or . If you pattern match on , GHC will know that relevant types are coercible to each other. This helps to avoid CPP in certain scenarios.Decodes as UCS-2.&Prints the raw bytes without decoding."String-Concatenation" for  . This is not the same as ().-Byte ordering of the internal representation.-Byte equality of the internal representation.On windows, decodes as UCS-2. On unix prints the raw bytes without decoding.-Byte ordering of the internal representation.-Byte equality of the internal representation.None(y"Partial unicode friendly encoding.7This encodes as UTF8 (strictly), which is a good guess. Throws an  if encoding fails. If the input does not contain surrogate chars, you can use .!Unsafe unicode friendly encoding.Like , except it crashes when the input contains surrogate chars. For sanitized input, this can be useful. Encode a  with the specified encoding.This mimics the behavior of the base library when doing filesystem operations (usually filepaths), which uses shady PEP 383 style encoding (based on the current locale, but PEP 383 only works properly on UTF-8 encodings, so good luck).Looking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then  may be feasible (make sure to deeply evaluate the result to catch exceptions).This mimics the behavior of the base library when doing string operations, which uses getLocaleEncoding.Looking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then  may be feasible (make sure to deeply evaluate the result to catch exceptions)."Partial unicode friendly decoding.This decodes as UTF8 (strictly), which is a good guess. Note that filenames on unix are encoding agnostic char arrays. Throws a  if decoding fails. Decode a  with the specified encoding.9The String is forced into memory to catch all exceptions.This mimics the behavior of the base library when doing filesystem operations, which uses getLocaleEncoding.Looking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then  may be feasible (make sure to deeply evaluate the result to catch exceptions).This mimics the behavior of the base library when doing filesystem operations (usually filepaths), which uses shady PEP 383 style encoding (based on the current locale, but PEP 383 only works properly on UTF-8 encodings, so good luck).Looking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then  may be feasible (make sure to deeply evaluate the result to catch exceptions)./Constructs a platform string from a ByteString.This is a no-op. os-stringLike , but not in IO. was designed to have a symmetric type signature on unix and windows, but morally the function has no IO effects on unix, so we provide this variant without breaking existing API.(This function does not exist on windows. QuasiQuote a . This accepts Unicode characters and encodes as UTF-8 on unix.5Unpack a platform string to a list of platform words.3Pack a list of platform words to a platform string.)Note that using this in conjunction with  to convert from [Char] to platform string is probably not what you want, because it will truncate unicode code points.Truncates to 1 octet.-Converts back to a unicode codepoint (total). os-stringO(n) Append a byte to the end of a OsString os-stringO(n)  is analogous to (:) for lists. os-stringO(1) Extract the last element of a OsString, which must be finite and non-empty. An exception will be thrown in the case of an empty OsString.+This is a partial function, consider using  instead. os-stringO(n) Extract the elements after the head of a OsString, which must be non-empty. An exception will be thrown in the case of an empty OsString.+This is a partial function, consider using  instead. os-stringO(n) Extract the  and  of a OsString, returning  if it is empty. os-stringO(1) Extract the first element of a OsString, which must be non-empty. An exception will be thrown in the case of an empty OsString.+This is a partial function, consider using  instead. os-stringO(n) Return all the elements of a OsString except the last one. An exception will be thrown in the case of an empty OsString.+This is a partial function, consider using  instead. os-stringO(n) Extract the  and  of a OsString, returning  if it is empty. os-stringO(1) . The empty OsString. os-stringO(1) The length of a OsString.(This returns the number of code units (Word8 on unix and Word16 on windows), not bytes. length "abc"3 os-stringO(n)  f xs& is the OsString obtained by applying f to each element of xs. os-stringO(n)  xs% efficiently returns the elements of xs in reverse order. os-stringO(n) The  function takes a OsString and a list of OsStrings and concatenates the list after interspersing the first argument between each element of the list. os-string, applied to a binary operator, a starting value (typically the left-identity of the operator), and a OsString, reduces the OsString using the binary operator, from left to right. os-string is like  , but strict in the accumulator. os-string is a variant of  that has no starting value argument, and thus must be applied to non-empty OsStrings. An exception will be thrown in the case of an empty OsString. os-string is like , but strict in the accumulator. An exception will be thrown in the case of an empty OsString. os-string, applied to a binary operator, a starting value (typically the right-identity of the operator), and a OsString, reduces the OsString using the binary operator, from right to left. os-string is like  , but strict in the accumulator. os-string is a variant of  that has no starting value argument, and thus must be applied to non-empty OsStrings An exception will be thrown in the case of an empty OsString. os-string is a variant of $, but is strict in the accumulator. os-stringO(n) Applied to a predicate and a OsString, $ determines if all elements of the OsString satisfy the predicate. os-stringO(n) Applied to a predicate and a OsString, # determines if any element of the OsString satisfies the predicate. os-stringO(n)  n x is a OsString of length n with x2 the value of every element. The following holds: .replicate w c = unfoldr w (\u -> Just (u,u)) c os-stringO(n), where n# is the length of the result. The 0 function is analogous to the List 'unfoldr'.  builds a OsString from a seed value. The function takes the element and returns 2 if it is done producing the OsString or returns  (a,b), in which case, a& is the next byte in the string, and b* is the seed value for further production.=This function is not efficient/safe. It will build a list of [Word8]) and run the generator until it returns 7, otherwise recurse infinitely, then finally create a OsString./If you know the maximum length, consider using . Examples:  unfoldr (\x -> if x <= 5 then Just (x, x + 1) else Nothing) 0 == pack [0, 1, 2, 3, 4, 5] os-stringO(n) Like ,  builds a OsString from a seed value. However, the length of the result is limited by the first argument to (. This function is more efficient than 1 when the maximum length of the result is known.The following equation relates  and : ,fst (unfoldrN n f s) == take n (unfoldr f s) os-stringO(n)  n, applied to a OsString xs, returns the prefix of xs of length n, or xs itself if n >  xs. os-stringO(n)  n xs is equivalent to  ( xs - n) xs . Takes n! elements from end of bytestring.takeEnd 3 "abcdefg""efg"takeEnd 0 "abcdefg"""takeEnd 4 "abc""abc" os-stringReturns the longest (possibly empty) suffix of elements satisfying the predicate. p is equivalent to  .  p . . os-string Similar to  , returns the longest (possibly empty) prefix of elements satisfying the predicate. os-stringO(n)  n xs returns the suffix of xs after the first n elements, or  if n >  xs. os-stringO(n)  n xs is equivalent to  ( xs - n) xs . Drops n! elements from end of bytestring.dropEnd 3 "abcdefg""abcd"dropEnd 0 "abcdefg" "abcdefg"dropEnd 4 "abc""" os-string Similar to , drops the longest (possibly empty) prefix of elements satisfying the predicate and returns the remainder. os-string Similar to , drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. p is equivalent to  .  p . . os-string>Returns the longest (possibly empty) suffix of elements which do not8 satisfy the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( (not . p) &&&  (not . p)). os-string Similar to , returns the longest (possibly empty) prefix of elements which do not8 satisfy the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( (not . p) &&&  (not . p)). os-string Similar to , returns the longest (possibly empty) prefix of elements satisfying the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( p &&&  p). os-stringReturns the longest (possibly empty) suffix of elements satisfying the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( p &&&  p).We have 0spanEnd (not . isSpace) "x y z" == ("x y ", "z")and spanEnd (not . isSpace) sbs == let (x, y) = span (not . isSpace) (reverse sbs) in (reverse y, reverse x) os-stringO(n)  n sbs is equivalent to ( n sbs,  n sbs). os-stringO(n) Break a OsString into pieces separated by the byte argument, consuming the delimiter. I.e. split 10 "a\nb\nd\ne" == ["a","b","d","e"] -- fromEnum '\n' == 10 split 97 "aXaXaXa" == ["","X","X","X",""] -- fromEnum 'a' == 97 split 120 "x" == ["",""] -- fromEnum 'x' == 120 split undefined "" == [] -- and not [""]and 9intercalate [c] . split c == id split == splitWith . (==) os-stringO(n) Splits a OsString into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg. splitWith (==97) "aabbaca" == ["","","bb","c",""] -- fromEnum 'a' == 97 splitWith undefined "" == [] -- and not [""] os-stringO(n) The * function takes two OsStrings and returns  the remainder of the second iff the first is its suffix, and otherwise . os-stringO(n) The * function takes two OsStrings and returns  the remainder of the second iff the first is its prefix, and otherwise . os-string3Check whether one string is a substring of another. os-stringO(n) The * function takes two OsStrings and returns  os-stringO(n) The * function takes two OsStrings and returns * iff the first is a suffix of the second.The following holds: 2isSuffixOf x y == reverse x `isPrefixOf` reverse y os-stringBreak a string on a substring, returning a pair of the part of the string prior to the match, and the rest of the string.!The following relationships hold: 0break (== c) l == breakSubstring (singleton c) l7For example, to tokenise a string, dropping delimiters: tokenise x y = h : if null t then [] else tokenise x (drop (length x) t) where (h,t) = breakSubstring x y,To skip to the first occurrence of a string: snd (breakSubstring x y)1To take the parts of a string before a delimiter: fst (breakSubstring x y)Note that calling `breakSubstring x` does some preprocessing work, so you should avoid unnecessarily duplicating breakSubstring calls with the same pattern. os-stringO(n)  is the OsString membership predicate. os-stringO(n) The  function takes a predicate and a OsString, and returns the first element in matching the predicate, or  if there is no such element. find f p = case findIndex f p of Just n -> Just (p ! n) ; _ -> Nothing os-stringO(n) , applied to a predicate and a OsString, returns a OsString containing those characters that satisfy the predicate. os-stringO(n) The  function takes a predicate a OsString and returns the pair of OsStrings with elements which do and do not satisfy the predicate, respectively; i.e., 6partition p bs == (filter p sbs, filter (not . p) sbs) os-stringO(1) OsString- index (subscript) operator, starting from 0. os-stringO(1) OsString& index, starting from 0, that returns  if: 0 <= n < length bs os-stringO(1) OsString& index, starting from 0, that returns  if: 0 <= n < length bs os-stringO(n) The ? function returns the index of the first element in the given OsString* which is equal to the query element, or  if there is no such element. os-stringO(n) The  function extends , by returning the indices of all elements equal to the query element, in ascending order. os-stringcount returns the number of times its argument appears in the OsString os-stringO(n) The " function takes a predicate and a OsString and returns the index of the first element in the OsString satisfying the predicate. os-stringO(n) The  function extends , by returning the indices of all elements satisfying the predicate, in ascending order.None (*"Partial unicode friendly encoding.On windows this encodes as UTF16-LE (strictly), which is a pretty good guess. On unix this encodes as UTF8 (strictly), which is a good guess. Throws an  if encoding fails. If the input does not contain surrogate chars, you can use .!Unsafe unicode friendly encoding.Like , except it crashes when the input contains surrogate chars. For sanitized input, this can be useful. Encode a  with the specified encoding.Note: on windows, we expect a "wide char" encoding (e.g. UCS-2 or UTF-16). Anything that works with Word16 boundaries. Picking an incompatible encoding may crash filepath operations.Like , except this mimics the behavior of the base library when doing filesystem operations (usually filepaths), which is: on unix, uses shady PEP 383 style encoding (based on the current locale, but PEP 383 only works properly on UTF-8 encodings, so good luck)on windows does permissive UTF-16 encoding, where coding errors generate Chars in the surrogate rangeLooking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then unsafePerformIO may be feasible (make sure to deeply evaluate the result to catch exceptions).Like , except this mimics the behavior of the base library when doing string operations, which is: on unix this uses getLocaleEncodingon windows does permissive UTF-16 encoding, where coding errors generate Chars in the surrogate rangeLooking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then unsafePerformIO may be feasible (make sure to deeply evaluate the result to catch exceptions)."Partial unicode friendly decoding.On windows this decodes as UTF16-LE (strictly), which is a pretty good guess. On unix this decodes as UTF8 (strictly), which is a good guess. Note that filenames on unix are encoding agnostic char arrays. Throws a  if decoding fails. Decode an  with the specified encoding.9The String is forced into memory to catch all exceptions.Like , except this mimics the behavior of the base library when doing filesystem operations (usually filepaths), which is: on unix, uses shady PEP 383 style encoding (based on the current locale, but PEP 383 only works properly on UTF-8 encodings, so good luck)on windows does permissive UTF-16 encoding, where coding errors generate Chars in the surrogate rangeLooking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then unsafePerformIO may be feasible (make sure to deeply evaluate the result to catch exceptions).Like , except this mimics the behavior of the base library when doing string operations, which is: on unix this uses getLocaleEncodingon windows does permissive UTF-16 encoding, where coding errors generate Chars in the surrogate rangeLooking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then unsafePerformIO may be feasible (make sure to deeply evaluate the result to catch exceptions).Constructs an OsString from a ByteString.On windows, this ensures valid UCS-2LE, on unix it is passed unchanged/unchecked.Throws 3 on invalid UCS-2LE on windows (although unlikely).QuasiQuote an . This accepts Unicode characters and encodes as UTF-8 on unix and UTF-16 on windows. If used as pattern, requires turning on the  ViewPatterns extension. Unpack an  to a list of .Pack a list of  to an )Note that using this in conjunction with  to convert from [Char] to  is probably not what you want, because it will truncate unicode code points.2Truncates on unix to 1 and on Windows to 2 octets.-Converts back to a unicode codepoint (total). os-stringO(n) Append a byte to the end of a  os-stringO(n)  is analogous to (:) for lists. os-stringO(1) Extract the last element of a OsString, which must be finite and non-empty. An exception will be thrown in the case of an empty OsString.+This is a partial function, consider using  instead. os-stringO(n) Extract the elements after the head of a OsString, which must be non-empty. An exception will be thrown in the case of an empty OsString.+This is a partial function, consider using  instead. os-stringO(n) Extract the  and  of a OsString, returning  if it is empty. os-stringO(1) Extract the first element of a OsString, which must be non-empty. An exception will be thrown in the case of an empty OsString.+This is a partial function, consider using  instead. os-stringO(n) Return all the elements of a  except the last one. An exception will be thrown in the case of an empty OsString.+This is a partial function, consider using  instead. os-stringO(n) Extract the  and  of a OsString, returning  if it is empty. os-stringO(1) Test whether a  is empty. os-stringO(1) The length of a . os-stringO(n)  f xs& is the OsString obtained by applying f to each element of xs. os-stringO(n)  xs% efficiently returns the elements of xs in reverse order. os-stringO(n) The  function takes a  and a list of s and concatenates the list after interspersing the first argument between each element of the list. os-string, applied to a binary operator, a starting value (typically the left-identity of the operator), and a OsString, reduces the OsString using the binary operator, from left to right. os-string is like  , but strict in the accumulator. os-string is a variant of  that has no starting value argument, and thus must be applied to non-empty s. An exception will be thrown in the case of an empty OsString. os-string is like , but strict in the accumulator. An exception will be thrown in the case of an empty OsString. os-string, applied to a binary operator, a starting value (typically the right-identity of the operator), and a OsString, reduces the OsString using the binary operator, from right to left. os-string is like  , but strict in the accumulator. os-string is a variant of  that has no starting value argument, and thus must be applied to non-empty s An exception will be thrown in the case of an empty OsString. os-string is a variant of $, but is strict in the accumulator. os-stringO(n) Applied to a predicate and a , $ determines if all elements of the  satisfy the predicate. os-stringO(n) Applied to a predicate and a , # determines if any element of the  satisfies the predicate. os-stringO(n)  n x is a OsString of length n with x2 the value of every element. The following holds: .replicate w c = unfoldr w (\u -> Just (u,u)) c os-stringO(n), where n# is the length of the result. The 0 function is analogous to the List 'unfoldr'.  builds a OsString from a seed value. The function takes the element and returns 2 if it is done producing the OsString or returns  (a,b), in which case, a& is the next byte in the string, and b* is the seed value for further production.=This function is not efficient/safe. It will build a list of [Word8]) and run the generator until it returns 7, otherwise recurse infinitely, then finally create a ./If you know the maximum length, consider using . Examples:  unfoldr (\x -> if x <= 5 then Just (x, x + 1) else Nothing) 0 == pack [0, 1, 2, 3, 4, 5] os-stringO(n) Like ,  builds a OsString from a seed value. However, the length of the result is limited by the first argument to (. This function is more efficient than 1 when the maximum length of the result is known.The following equation relates  and : ,fst (unfoldrN n f s) == take n (unfoldr f s) os-stringO(n)  n, applied to a OsString xs, returns the prefix of xs of length n, or xs itself if n >  xs. os-stringO(n)  n xs is equivalent to  ( xs - n) xs . Takes n! elements from end of bytestring.takeEnd 3 "abcdefg""efg"takeEnd 0 "abcdefg"""takeEnd 4 "abc""abc" os-stringReturns the longest (possibly empty) suffix of elements satisfying the predicate. p is equivalent to  .  p . . os-string Similar to  , returns the longest (possibly empty) prefix of elements satisfying the predicate. os-stringO(n)  n xs returns the suffix of xs after the first n elements, or  if n >  xs. os-stringO(n)  n xs is equivalent to  ( xs - n) xs . Drops n! elements from end of bytestring.dropEnd 3 "abcdefg""abcd"dropEnd 0 "abcdefg" "abcdefg"dropEnd 4 "abc""" os-string Similar to , drops the longest (possibly empty) prefix of elements satisfying the predicate and returns the remainder. os-string Similar to , drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. p is equivalent to  .  p . . os-string>Returns the longest (possibly empty) suffix of elements which do not8 satisfy the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( (not . p) &&&  (not . p)). os-string Similar to , returns the longest (possibly empty) prefix of elements which do not8 satisfy the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( (not . p) &&&  (not . p)). os-string Similar to , returns the longest (possibly empty) prefix of elements satisfying the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( p &&&  p). os-stringReturns the longest (possibly empty) suffix of elements satisfying the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( p &&&  p).We have 0spanEnd (not . isSpace) "x y z" == ("x y ", "z")and spanEnd (not . isSpace) sbs == let (x, y) = span (not . isSpace) (reverse sbs) in (reverse y, reverse x) os-stringO(n)  n sbs is equivalent to ( n sbs,  n sbs). os-stringO(n) Break a  into pieces separated by the byte argument, consuming the delimiter. I.e. split 10 "a\nb\nd\ne" == ["a","b","d","e"] -- fromEnum '\n' == 10 split 97 "aXaXaXa" == ["","X","X","X",""] -- fromEnum 'a' == 97 split 120 "x" == ["",""] -- fromEnum 'x' == 120 split undefined "" == [] -- and not [""]and 9intercalate [c] . split c == id split == splitWith . (==) os-stringO(n) Splits a  into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg. splitWith (==97) "aabbaca" == ["","","bb","c",""] -- fromEnum 'a' == 97 splitWith undefined "" == [] -- and not [""] os-stringO(n) The * function takes two OsStrings and returns  the remainder of the second iff the first is its suffix, and otherwise . os-stringO(n) The * function takes two OsStrings and returns  the remainder of the second iff the first is its prefix, and otherwise . os-string3Check whether one string is a substring of another. os-stringO(n) The * function takes two OsStrings and returns  os-stringO(n) The * function takes two OsStrings and returns * iff the first is a suffix of the second.The following holds: 2isSuffixOf x y == reverse x `isPrefixOf` reverse y os-stringBreak a string on a substring, returning a pair of the part of the string prior to the match, and the rest of the string.!The following relationships hold: 0break (== c) l == breakSubstring (singleton c) l7For example, to tokenise a string, dropping delimiters: tokenise x y = h : if null t then [] else tokenise x (drop (length x) t) where (h,t) = breakSubstring x y,To skip to the first occurrence of a string: snd (breakSubstring x y)1To take the parts of a string before a delimiter: fst (breakSubstring x y)Note that calling `breakSubstring x` does some preprocessing work, so you should avoid unnecessarily duplicating breakSubstring calls with the same pattern. os-stringO(n)  is the  membership predicate. os-stringO(n) The  function takes a predicate and a OsString, and returns the first element in matching the predicate, or  if there is no such element. find f p = case findIndex f p of Just n -> Just (p ! n) ; _ -> Nothing os-stringO(n) , applied to a predicate and a OsString, returns a OsString containing those characters that satisfy the predicate. os-stringO(n) The  function takes a predicate a OsString and returns the pair of OsStrings with elements which do and do not satisfy the predicate, respectively; i.e., 6partition p bs == (filter p sbs, filter (not . p) sbs) os-stringO(1) - index (subscript) operator, starting from 0. os-stringO(1) & index, starting from 0, that returns  if: 0 <= n < length bs os-stringO(1) & index, starting from 0, that returns  if: 0 <= n < length bs os-stringO(n) The ? function returns the index of the first element in the given * which is equal to the query element, or  if there is no such element. os-stringO(n) The  function extends , by returning the indices of all elements equal to the query element, in ascending order. os-stringcount returns the number of times its argument appears in the OsString os-stringO(n) The " function takes a predicate and a  and returns the index of the first element in the OsString satisfying the predicate. os-stringO(n) The  function extends , by returning the indices of all elements satisfying the predicate, in ascending order.unix text encoding!windows text encoding (wide char)unix text encodingwindows text encoding  2021 Julian OspaldMIT"Julian Ospald  experimentalportableNone͝Like , except this mimics the behavior of the base library when doing filesystem operations (usually filepaths), which is: on unix, uses shady PEP 383 style encoding (based on the current locale, but PEP 383 only works properly on UTF-8 encodings, so good luck)on windows does permissive UTF-16 encoding, where coding errors generate Chars in the surrogate rangeLooking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then unsafePerformIO may be feasible (make sure to deeply evaluate the result to catch exceptions).Like , except this mimics the behavior of the base library when doing filesystem operations (usually filepaths), which is: on unix, uses shady PEP 383 style encoding (based on the current locale, but PEP 383 only works properly on UTF-8 encodings, so good luck)on windows does permissive UTF-16 encoding, where coding errors generate Chars in the surrogate rangeLooking up the locale requires IO. If you're not worried about calls to setFileSystemEncoding, then unsafePerformIO may be feasible (make sure to deeply evaluate the result to catch exceptions). None( L"Partial unicode friendly encoding.This encodes as UTF16-LE (strictly), which is a pretty good guess. Throws an  if encoding fails. If the input does not contain surrogate chars, you can use unsafeEncodeUtf.!Unsafe unicode friendly encoding.Like , except it crashes when the input contains surrogate chars. For sanitized input, this can be useful. Encode a  with the specified encoding.Note: We expect a "wide char" encoding (e.g. UCS-2 or UTF-16). Anything that works with Word16 boundaries. Picking an incompatible encoding may crash filepath operations.This mimics the behavior of the base library when doing filesystem operations (usually filepaths), which does permissive UTF-16 encoding, where coding errors generate Chars in the surrogate range.The reason this is in IO is because it unifies with the Posix counterpart, which does require IO. This is safe to /unsafeDupablePerformIO.This mimics the behavior of the base library when doing string operations, which does permissive UTF-16 encoding, where coding errors generate Chars in the surrogate range.The reason this is in IO is because it unifies with the Posix counterpart, which does require IO. This is safe to /unsafeDupablePerformIO. os-stringLike 'encodeLE but not in IO. was designed to have a symmetric type signature on unix and windows, but morally the function has no IO effects on windows, so we provide this variant without breaking existing API. On windows,  is equivalent to .%This function does not exist on unix."Partial unicode friendly decoding. Just (u,u)) c os-stringO(n), where n# is the length of the result. The 0 function is analogous to the List 'unfoldr'.  builds a OsString from a seed value. The function takes the element and returns 2 if it is done producing the OsString or returns  (a,b), in which case, a& is the next byte in the string, and b* is the seed value for further production.=This function is not efficient/safe. It will build a list of [Word8]) and run the generator until it returns 7, otherwise recurse infinitely, then finally create a OsString./If you know the maximum length, consider using . Examples:  unfoldr (\x -> if x <= 5 then Just (x, x + 1) else Nothing) 0 == pack [0, 1, 2, 3, 4, 5] os-stringO(n) Like ,  builds a OsString from a seed value. However, the length of the result is limited by the first argument to (. This function is more efficient than 1 when the maximum length of the result is known.The following equation relates  and : ,fst (unfoldrN n f s) == take n (unfoldr f s) os-stringO(n)  n, applied to a OsString xs, returns the prefix of xs of length n, or xs itself if n >  xs. os-stringO(n)  n xs is equivalent to  ( xs - n) xs . Takes n! elements from end of bytestring.takeEnd 3 "abcdefg""efg"takeEnd 0 "abcdefg"""takeEnd 4 "abc""abc" os-stringReturns the longest (possibly empty) suffix of elements satisfying the predicate. p is equivalent to  .  p . . os-string Similar to  , returns the longest (possibly empty) prefix of elements satisfying the predicate. os-stringO(n)  n xs returns the suffix of xs after the first n elements, or  if n >  xs. os-stringO(n)  n xs is equivalent to  ( xs - n) xs . Drops n! elements from end of bytestring.dropEnd 3 "abcdefg""abcd"dropEnd 0 "abcdefg" "abcdefg"dropEnd 4 "abc""" os-string Similar to , drops the longest (possibly empty) prefix of elements satisfying the predicate and returns the remainder. os-string Similar to , drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. p is equivalent to  .  p . . os-string>Returns the longest (possibly empty) suffix of elements which do not8 satisfy the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( (not . p) &&&  (not . p)). os-string Similar to , returns the longest (possibly empty) prefix of elements which do not8 satisfy the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( (not . p) &&&  (not . p)). os-string Similar to , returns the longest (possibly empty) prefix of elements satisfying the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( p &&&  p). os-stringReturns the longest (possibly empty) suffix of elements satisfying the predicate and the remainder of the string. p is equivalent to  (not . p) and to ( p &&&  p).We have 0spanEnd (not . isSpace) "x y z" == ("x y ", "z")and spanEnd (not . isSpace) sbs == let (x, y) = span (not . isSpace) (reverse sbs) in (reverse y, reverse x) os-stringO(n)  n sbs is equivalent to ( n sbs,  n sbs). os-stringO(n) Break a OsString into pieces separated by the byte argument, consuming the delimiter. I.e. split 10 "a\nb\nd\ne" == ["a","b","d","e"] -- fromEnum '\n' == 10 split 97 "aXaXaXa" == ["","X","X","X",""] -- fromEnum 'a' == 97 split 120 "x" == ["",""] -- fromEnum 'x' == 120 split undefined "" == [] -- and not [""]and 9intercalate [c] . split c == id split == splitWith . (==) os-stringO(n) Splits a OsString into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg. splitWith (==97) "aabbaca" == ["","","bb","c",""] -- fromEnum 'a' == 97 splitWith undefined "" == [] -- and not [""] os-stringO(n) The * function takes two OsStrings and returns  the remainder of the second iff the first is its suffix, and otherwise . os-stringO(n) The * function takes two OsStrings and returns  the remainder of the second iff the first is its prefix, and otherwise . os-string3Check whether one string is a substring of another. os-stringO(n) The * function takes two OsStrings and returns  os-stringO(n) The * function takes two OsStrings and returns * iff the first is a suffix of the second.The following holds: 2isSuffixOf x y == reverse x `isPrefixOf` reverse y os-stringBreak a string on a substring, returning a pair of the part of the string prior to the match, and the rest of the string.!The following relationships hold: 0break (== c) l == breakSubstring (singleton c) l7For example, to tokenise a string, dropping delimiters: tokenise x y = h : if null t then [] else tokenise x (drop (length x) t) where (h,t) = breakSubstring x y,To skip to the first occurrence of a string: snd (breakSubstring x y)1To take the parts of a string before a delimiter: fst (breakSubstring x y)Note that calling `breakSubstring x` does some preprocessing work, so you should avoid unnecessarily duplicating breakSubstring calls with the same pattern. os-stringO(n)  is the OsString membership predicate. os-stringO(n) The  function takes a predicate and a OsString, and returns the first element in matching the predicate, or  if there is no such element. find f p = case findIndex f p of Just n -> Just (p ! n) ; _ -> Nothing os-stringO(n) , applied to a predicate and a OsString, returns a OsString containing those characters that satisfy the predicate. os-stringO(n) The  function takes a predicate a OsString and returns the pair of OsStrings with elements which do and do not satisfy the predicate, respectively; i.e., 6partition p bs == (filter p sbs, filter (not . p) sbs) os-stringO(1) OsString- index (subscript) operator, starting from 0. os-stringO(1) OsString& index, starting from 0, that returns  if: 0 <= n < length bs os-stringO(1) OsString& index, starting from 0, that returns  if: 0 <= n < length bs os-stringO(n) The ? function returns the index of the first element in the given OsString* which is equal to the query element, or  if there is no such element. os-stringO(n) The  function extends , by returning the indices of all elements equal to the query element, in ascending order. os-stringcount returns the number of times its argument appears in the OsString os-stringO(n) The " function takes a predicate and a OsString and returns the index of the first element in the OsString satisfying the predicate. os-stringO(n) The  function extends , by returning the indices of all elements satisfying the predicate, in ascending order.text encoding (wide char) !"#$%&'()*+,-./0123456789:;< =>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"#$'()*+,-./0:;HIJ<= >?@ABCDEKN23456789OPQRSTUVW$#"'()*+,-./0123674589:;&HIJ<=> ?@ABCDEFGKLMNOQPRSTUVW$#"'()*+,-./0123674589:;&HIJ<=> ?@ABCDEFGKLMNOQPRSTUVW               $ # "    ' ( ) * + , - .   / 0 1 2 3 6 7 4 5 8 9 : ; & H I J < = > ? @   A   B C D E F G K L M N O Q P R    S T U V Wos-string-2.0.7-20d6%System.OsString.Data.ByteString.Short.System.OsString.Data.ByteString.Short.Internal,System.OsString.Data.ByteString.Short.Word16"System.OsString.Internal.Exception!System.OsString.Encoding.InternalSystem.OsString.Internal.TypesSystem.OsString.PosixSystem.OsString.InternalSystem.OsStringSystem.OsString.WindowsP takeWhile dropWhile dropWhileEndbreakspan5System.OsString.EncodingPreludebytestring-0.12.2.0-d3f3Data.ByteString.Short.InternalShortByteStringunShortByteStringSBSemptylengthnullindex indexMaybe!?toShort fromShort singletonpackunpackappendconcatsnocconslasttailunconsheadinitunsnocmapreverse intercalatefoldlfoldl'foldrfoldr'foldl1foldl1'foldr1foldr1'allanytaketakeEnd takeWhileEnddropdropEndbreakEndspanEndsplitAtsplit splitWith stripSuffix stripPrefix replicateunfoldrunfoldrN isInfixOf isPrefixOf isSuffixOfbreakSubstringelemfilterfind partition elemIndex elemIndicescount findIndex findIndices packCStringpackCStringLen useAsCStringuseAsCStringLenMBAMBA#BABA#_nulisSpace word16ToCharcreateasBAnewPinnedByteArray newByteArray copyByteArrayunsafeFreezeByteArraycopyAddrToByteArray packCWStringpackCWStringLen useAsCWStringuseAsCWStringLen newCWString moduleErrorIOmoduleErrorMsg packWord16 packLenWord16 unpackWord16 packWord16RevpackLenWord16RevwriteWord16ArrayindexWord8ArrayindexWord16Array word16ToLE# word16FromLE# setByteArraycopyMutableByteArray createAndTrimcreateAndTrim'createAndTrim''findIndexOrLengthfindFromEndUntil assertEven errorEmptySBS moduleErrorcompareByteArraysOffuncons2 numWord16trySafeisAsyncExceptionEncodingException EncodingErrorucs2lemkUcs2le ucs2le_DF ucs2le_EF ucs2le_decode ucs2le_encode utf16le_b mkUTF16le_b utf16le_b_DF utf16le_b_EFutf16le_b_decodeutf16le_b_encodecWcharsToChars_UCS2cWcharsToCharscharsToCWcharswithWindowsStringpeekWindowsStringwithPosixStringwithPosixString'peekPosixStringpeekPosixString' decodeWithTE encodeWithTEdecodeWithBasePosixdecodeWithBasePosix'encodeWithBasePosixencodeWithBasePosix'decodeWithBaseWindowsencodeWithBaseWindowsshowEncodingExceptionwNUL$fNFDataEncodingException$fExceptionEncodingException$fShowEncodingException$fEqEncodingExceptionOsChar getOsCharOsString getOsString PlatformChar PosixChar getPosixChar WindowsChargetWindowsCharPlatformString PosixStringgetPosixString WindowsStringgetWindowsStringPWunPWWWunWWPSunPSWSunWScoercionToPlatformTypes$fLiftBoxedRepWindowsString$fShowWindowsString$fLiftBoxedRepPosixString$fShowPosixString$fShowWindowsChar$fShowPosixChar$fLiftBoxedRepOsString$fSemigroupOsString$fMonoidOsString $fOrdOsString $fEqOsString$fShowOsString $fOrdOsChar $fEqOsChar $fShowOsChar$fGenericOsChar$fNFDataOsChar$fGenericOsString$fNFDataOsString $fEqPosixChar$fOrdPosixChar$fGenericPosixChar$fNFDataPosixChar$fEqWindowsChar$fOrdWindowsChar$fGenericWindowsChar$fNFDataWindowsChar$fEqPosixString$fOrdPosixString$fSemigroupPosixString$fMonoidPosixString$fGenericPosixString$fNFDataPosixString$fEqWindowsString$fOrdWindowsString$fSemigroupWindowsString$fMonoidWindowsString$fGenericWindowsString$fNFDataWindowsString encodeUtfunsafeEncodeUtf encodeWithencodeFSencodeLE decodeUtf decodeWithdecodeLEdecodeFS fromBytesfromBytestringpstrunsafeFromChartoCharosstr fromString ghc-internalGHC.Internal.WordWord16Word8GHC.Internal.MaybeNothingJust unsafeIndexGHC.Internal.IO.Encoding.Types TextEncodingGHC.Internal.BaseStringGHC.Internal.IO.UnsafeunsafePerformIOghc-prim GHC.TypesTrueGHC.Internal.IOFilePath