Safe Haskell | None |
---|---|
Language | Haskell2010 |
- fromString :: IsString a => String -> a
- class IsText a where
- class IsText a => IsBytes a where
- data Text :: *
- data ByteString :: *
- type StrictText = Text
- type StrictByteString = ByteString
- singleton :: Char -> Text
- fromChunks :: [Text] -> Text
- toChunks :: Text -> [Text]
- toCaseFold :: Text -> Text
- toLower :: Text -> Text
- toUpper :: Text -> Text
- toTitle :: Text -> Text
- lines :: Text -> [Text]
- words :: Text -> [Text]
- unlines :: [Text] -> Text
- unwords :: [Text] -> Text
- isPrefixOf :: Text -> Text -> Bool
- isSuffixOf :: Text -> Text -> Bool
- isInfixOf :: Text -> Text -> Bool
Documentation
fromString :: IsString a => String -> a #
fromText :: Text -> a Source #
fromText' :: StrictText -> a Source #
readBytes' :: StrictByteString -> Either UnicodeException a Source #
readBytes :: ByteString -> Either UnicodeException a Source #
class IsText a => IsBytes a where Source #
fromBytes :: ByteString -> a Source #
fromBytes' :: StrictByteString -> a Source #
data ByteString :: * #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A lazy ByteString
contains 8-bit bytes, or by using the operations
from Data.ByteString.Lazy.Char8 it can be interpreted as containing
8-bit characters.
type StrictText = Text Source #
type StrictByteString = ByteString Source #
O(1) Convert a character into a Text. Subject to fusion. Performs replacement on invalid scalar values.
toCaseFold :: Text -> Text #
O(n) Convert a string to folded case. Subject to fusion.
This function is mainly useful for performing caseless (or case insensitive) string comparisons.
A string x
is a caseless match for a string y
if and only if:
toCaseFold x == toCaseFold y
The result string may be longer than the input string, and may
differ from applying toLower
to the input string. For instance,
the Armenian small ligature men now (U+FB13) is case folded to the
bigram men now (U+0574 U+0576), while the micro sign (U+00B5) is
case folded to the Greek small letter letter mu (U+03BC) instead of
itself.
O(n) Convert a string to lower case, using simple case conversion. Subject to fusion.
The result string may be longer than the input string. For instance, the Latin capital letter I with dot above (U+0130) maps to the sequence Latin small letter i (U+0069) followed by combining dot above (U+0307).
O(n) Convert a string to upper case, using simple case conversion. Subject to fusion.
The result string may be longer than the input string. For instance, the German eszett (U+00DF) maps to the two-letter sequence SS.
O(n) Convert a string to title case, using simple case conversion. Subject to fusion.
The first letter of the input is converted to title case, as is every subsequent letter that immediately follows a non-letter. Every letter that immediately follows another letter is converted to lower case.
The result string may be longer than the input string. For example, the Latin small ligature fl (U+FB02) is converted to the sequence Latin capital letter F (U+0046) followed by Latin small letter l (U+006C).
Note: this function does not take language or culture specific rules into account. For instance, in English, different style guides disagree on whether the book name "The Hill of the Red Fox" is correctly title cased—but this function will capitalize every word.
isPrefixOf :: Text -> Text -> Bool #
O(n) The isPrefixOf
function takes two Text
s and returns
True
iff the first is a prefix of the second. Subject to fusion.
isSuffixOf :: Text -> Text -> Bool #
O(n) The isSuffixOf
function takes two Text
s and returns
True
iff the first is a suffix of the second.