1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
-- |
-- Module : System.OsPath.Data.ByteString.Short.Word16
-- Copyright : © 2022 Julian Ospald
-- License : MIT
--
-- Maintainer : Julian Ospald <hasufell@posteo.de>
-- Stability : experimental
-- Portability : portable
--
-- ShortByteStrings encoded as UTF16-LE, suitable for windows FFI calls.
--
-- Word16s are *always* in BE encoding (both input and output), so e.g. 'pack'
-- takes a list of BE encoded @[Word16]@ and produces a UTF16-LE encoded ShortByteString.
--
-- Likewise, 'unpack' takes a UTF16-LE encoded ShortByteString and produces a list of BE encoded @[Word16]@.
--
-- Indices and lengths are always in respect to Word16, not Word8.
--
-- All functions will error out if the input string is not a valid UTF16 stream (uneven number of bytes).
-- So use this module with caution.
module System.OsPath.Data.ByteString.Short.Word16 {-# DEPRECATED "Use System.OsString.Data.ByteString.Short.Word16 from os-string >= 2.0.0 package instead. This module will be removed in filepath >= 1.5." #-} (
-- * The @ShortByteString@ type and representation
ShortByteString(..),
-- * Introducing and eliminating 'ShortByteString's
empty,
singleton,
pack,
unpack,
fromShort,
toShort,
-- * Basic interface
snoc,
cons,
append,
last,
tail,
uncons,
uncons2,
head,
init,
unsnoc,
null,
length,
numWord16,
-- * Transforming ShortByteStrings
map,
reverse,
intercalate,
-- * Reducing 'ShortByteString's (folds)
foldl,
foldl',
foldl1,
foldl1',
foldr,
foldr',
foldr1,
foldr1',
-- ** Special folds
all,
any,
concat,
-- ** Generating and unfolding ByteStrings
replicate,
unfoldr,
unfoldrN,
-- * Substrings
-- ** Breaking strings
take,
takeEnd,
takeWhileEnd,
takeWhile,
drop,
dropEnd,
dropWhile,
dropWhileEnd,
breakEnd,
break,
span,
spanEnd,
splitAt,
split,
splitWith,
stripSuffix,
stripPrefix,
-- * Predicates
isInfixOf,
isPrefixOf,
isSuffixOf,
-- ** Search for arbitrary substrings
breakSubstring,
-- * Searching ShortByteStrings
-- ** Searching by equality
elem,
-- ** Searching with a predicate
find,
filter,
partition,
-- * Indexing ShortByteStrings
index,
indexMaybe,
(!?),
elemIndex,
elemIndices,
count,
findIndex,
findIndices,
-- ** Encoding validation
-- isValidUtf8,
-- * Low level conversions
-- ** Packing 'CString's and pointers
packCWString,
packCWStringLen,
newCWString,
-- ** Using ShortByteStrings as 'CString's
useAsCWString,
useAsCWStringLen
)
where
import Prelude hiding
( Foldable(..)
, all
, any
, reverse
, break
, concat
, drop
, dropWhile
, filter
, head
, init
, last
, map
, replicate
, span
, splitAt
, tail
, take
, takeWhile
)
import System.OsPath.Data.ByteString.Short.Word16.Hidden
|