Copyright | (c) Andrey Mulik 2020 |
---|---|
License | BSD-style |
Maintainer | work.a.mulik@gmail.com |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe |
Language | Haskell2010 |
SDP.Text.Lazy provides sdp
instances for lazy Text
.
Synopsis
- module System.IO.Classes
- module SDP.IndexedM
- type LText = Text
- data Text
- toCaseFold :: Text -> Text
- toLower :: Text -> Text
- toUpper :: Text -> Text
- toTitle :: Text -> Text
- fromChunks :: [Text] -> Text
- toChunks :: Text -> [Text]
- toStrict :: Text -> Text
- fromStrict :: Text -> Text
- foldrChunks :: (Text -> a -> a) -> a -> Text -> a
- foldlChunks :: (a -> Text -> a) -> a -> Text -> a
Exports
module System.IO.Classes
module SDP.IndexedM
Lazy text
Instances
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.
Since: text-1.0.0.0
foldrChunks :: (Text -> a -> a) -> a -> Text -> a #
Consume the chunks of a lazy Text
with a natural right fold.
foldlChunks :: (a -> Text -> a) -> a -> Text -> a #
Consume the chunks of a lazy Text
with a strict, tail-recursive,
accumulating left fold.