precursor-0.1.0.0: Prelude replacement

Safe HaskellNone
LanguageHaskell2010

Precursor.Text.Text

Synopsis

Documentation

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.

Instances

Eq ByteString 
Data ByteString 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ByteString -> c ByteString #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ByteString #

toConstr :: ByteString -> Constr #

dataTypeOf :: ByteString -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c ByteString) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ByteString) #

gmapT :: (forall b. Data b => b -> b) -> ByteString -> ByteString #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r #

gmapQ :: (forall d. Data d => d -> u) -> ByteString -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ByteString -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

Ord ByteString 
Read ByteString 
Show ByteString 
IsString ByteString 
Semigroup ByteString 
Monoid ByteString 
NFData ByteString 

Methods

rnf :: ByteString -> () #

IsBytes ByteString Source # 
IsText ByteString Source # 

singleton :: Char -> Text #

O(1) Convert a character into a Text. Subject to fusion. Performs replacement on invalid scalar values.

fromChunks :: [Text] -> Text #

O(c) Convert a list of strict Texts into a lazy Text.

toChunks :: Text -> [Text] #

O(n) Convert a lazy Text into a list of strict Texts.

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.

toLower :: Text -> Text #

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).

toUpper :: Text -> Text #

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.

toTitle :: Text -> Text #

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.

lines :: Text -> [Text] #

O(n) Breaks a Text up into a list of Texts at newline Chars. The resulting strings do not contain newlines.

words :: Text -> [Text] #

O(n) Breaks a Text up into a list of words, delimited by Chars representing white space.

unlines :: [Text] -> Text #

O(n) Joins lines, after appending a terminating newline to each.

unwords :: [Text] -> Text #

O(n) Joins words using single space characters.

isPrefixOf :: Text -> Text -> Bool #

O(n) The isPrefixOf function takes two Texts 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 Texts and returns True iff the first is a suffix of the second.

isInfixOf :: Text -> Text -> Bool #

O(n+m) The isInfixOf function takes two Texts and returns True iff the first is contained, wholly and intact, anywhere within the second.

This function is strict in its first argument, and lazy in its second.

In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).