Safe Haskell | None |
---|---|
Language | Haskell2010 |
Compact representation of short Strings
This module is designed to be import qualifeid
import Distribution.Utils.ShortText (ShortText) import qualifeid Distribution.Utils.ShortText as ShortText
Synopsis
- data ShortText
- toShortText :: String -> ShortText
- fromShortText :: ShortText -> String
- unsafeFromUTF8BS :: ByteString -> ShortText
- null :: ShortText -> Bool
- length :: ShortText -> Int
- decodeStringUtf8 :: [Word8] -> String
- encodeStringUtf8 :: String -> [Word8]
ShortText
type
Compact representation of short Strings
The data is stored internally as UTF8 in an
ShortByteString
when compiled against bytestring >=
0.10.4
, and otherwise the fallback is to use plain old non-compat
'[Char]'.
Note: This type is for internal uses (such as e.g. PackageName
)
and shall not be exposed in Cabal's API
Since: 2.0.0.2
Instances
unsafeFromUTF8BS :: ByteString -> ShortText #
Convert from UTF-8 encoded strict ByteString
.
Since: 3.2.0.0
Operations
internal utilities
decodeStringUtf8 :: [Word8] -> String #
Decode String
from UTF8-encoded octets.
Invalid data in the UTF8 stream (this includes code-points U+D800
through U+DFFF
) will be decoded as the replacement character (U+FFFD
).
See also encodeStringUtf8
encodeStringUtf8 :: String -> [Word8] #
Encode String
to a list of UTF8-encoded octets
Code-points in the U+D800
-U+DFFF
range will be encoded
as the replacement character (i.e. U+FFFD
).
See also decodeUtf8