planet-mitchell-0.1.0: Planet Mitchell

Safe HaskellSafe
LanguageHaskell2010

Text.Partial

Synopsis

Documentation

count :: Text -> Text -> Int #

O(n+m) The count function returns the number of times the query string appears in the given Text. An empty query string is invalid, and will cause an error to be raised.

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

decodeLatin1 :: ByteString -> Text #

Decode a ByteString containing Latin-1 (aka ISO-8859-1) encoded text.

decodeLatin1 is semantically equivalent to Data.Text.pack . Data.ByteString.Char8.unpack

decodeUtf16BE :: ByteString -> Text #

Decode text from big endian UTF-16 encoding.

If the input contains any invalid big endian UTF-16 data, an exception will be thrown. For more control over the handling of invalid data, use decodeUtf16BEWith.

decodeUtf16LE :: ByteString -> Text #

Decode text from little endian UTF-16 encoding.

If the input contains any invalid little endian UTF-16 data, an exception will be thrown. For more control over the handling of invalid data, use decodeUtf16LEWith.

decodeUtf32BE :: ByteString -> Text #

Decode text from big endian UTF-32 encoding.

If the input contains any invalid big endian UTF-32 data, an exception will be thrown. For more control over the handling of invalid data, use decodeUtf32BEWith.

decodeUtf32LE :: ByteString -> Text #

Decode text from little endian UTF-32 encoding.

If the input contains any invalid little endian UTF-32 data, an exception will be thrown. For more control over the handling of invalid data, use decodeUtf32LEWith.

decodeUtf8 :: ByteString -> Text #

Decode a ByteString containing UTF-8 encoded text that is known to be valid.

If the input contains any invalid UTF-8 data, an exception will be thrown that cannot be caught in pure code. For more control over the handling of invalid data, use decodeUtf8' or decodeUtf8With.

foldl1' :: (Char -> Char -> Char) -> Text -> Char #

O(n) A strict version of foldl1. Subject to fusion.

foldr1 :: (Char -> Char -> Char) -> Text -> Char #

O(n) A variant of foldr that has no starting value argument, and thus must be applied to a non-empty Text. Subject to fusion.

head :: Text -> Char #

O(1) Returns the first character of a Text, which must be non-empty. Subject to fusion.

index :: Text -> Int -> Char #

O(n) Text index (subscript) operator, starting from 0.

init :: Text -> Text #

O(1) Returns all but the last character of a Text, which must be non-empty. Subject to fusion.

last :: Text -> Char #

O(1) Returns the last character of a Text, which must be non-empty. Subject to fusion.

maximum :: Text -> Char #

O(n) maximum returns the maximum value from a Text, which must be non-empty. Subject to fusion.

minimum :: Text -> Char #

O(n) minimum returns the minimum value from a Text, which must be non-empty. Subject to fusion.

splitOn #

Arguments

:: Text

String to split on. If this string is empty, an error will occur.

-> Text

Input text.

-> [Text] 

O(m+n) Break a Text into pieces separated by the first Text argument (which cannot be empty), consuming the delimiter. An empty delimiter is invalid, and will cause an error to be raised.

Examples:

>>> splitOn "\r\n" "a\r\nb\r\nd\r\ne"
["a","b","d","e"]
>>> splitOn "aaa"  "aaaXaaaXaaaXaaa"
["","X","X","X",""]
>>> splitOn "x"    "x"
["",""]

and

intercalate s . splitOn s         == id
splitOn (singleton c)             == split (==c)

(Note: the string s to split on above cannot be empty.)

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

tail :: Text -> Text #

O(1) Returns all characters after the head of a Text, which must be non-empty. Subject to fusion.