planet-mitchell-0.1.0: Planet Mitchell

Safe HaskellNone
LanguageHaskell2010

ByteString.Utf8

Contents

Synopsis

Documentation

break :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) #

Split a string into two parts: the first is the longest prefix that contains only characters that do not satisfy the predicate; the second part is the rest of the string. Invalid characters are passed as '\0xFFFD' to the predicate.

drop :: Int -> ByteString -> ByteString #

drop n s returns the s without its first n characters. If s has less than n characters, then we return an empty string.

foldl :: (a -> Char -> a) -> a -> ByteString -> a #

Traverse a bytestring (left biased). This function is strict in the accumulator.

foldr :: (Char -> a -> a) -> a -> ByteString -> a #

Traverse a bytestring (right biased).

fromString :: String -> ByteString #

Converts a Haskell string into a UTF8 encoded bytestring.

length :: ByteString -> Int #

Counts the number of characters encoded in the bytestring. Note that this includes replacement characters.

span :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) #

Split a string into two parts: the first is the longest prefix that contains only characters that satisfy the predicate; the second part is the rest of the string. Invalid characters are passed as '\0xFFFD' to the predicate.

splitAt :: Int -> ByteString -> (ByteString, ByteString) #

Split after a given number of characters. Negative values are treated as if they are 0.

take :: Int -> ByteString -> ByteString #

take n s returns the first n characters of s. If s has less than n characters, then we return the whole of s.

toString :: ByteString -> String #

Convert a UTF8 encoded bytestring into a Haskell string. Invalid characters are replaced with '\xFFFD'.

uncons :: ByteString -> Maybe (Char, ByteString) #

Get the first character of a byte string, if any. Malformed characters are replaced by '\0xFFFD'.

Optics

utf8 :: Prism' ByteString Text #

Encode/Decode a strict Text to/from strict ByteString, via UTF-8.

>>> utf8 # "☃"
"\226\152\131"