stdio-0.1.1.0: A simple and high performance IO toolkit for Haskell

Std.Data.Text.Search

Description

Synopsis

# element-wise search

elem :: Char -> Text -> Bool Source #

O(n) elem test if given char is in given text.

O(n) not . elem

# Searching by equality

findIndices :: (Char -> Bool) -> Text -> [Int] Source #

Arguments

 :: (Char -> Bool) -> Text -> (Int, Int, Maybe Char) (char index, byte index, matching char)

O(n) find the first char matching the predicate in a text from left to right, if there isn't one, return the index point to the end of the byte slice.

findR :: (Char -> Bool) -> Text -> (Int, Int, Maybe Char) Source #

O(n) find the first char matching the predicate in a text from right to left, if there isn't one, return the index point to the end of the byte slice.

findIndex :: (Char -> Bool) -> Text -> Int Source #

O(n) find the index of the byte slice.

findIndexR :: (Char -> Bool) -> Text -> Int Source #

O(n) find the index of the byte slice in reverse order.

filter :: (Char -> Bool) -> Text -> Text Source #

O(n) filter, applied to a predicate and a text, returns a text containing those chars that satisfy the predicate.

partition :: (Char -> Bool) -> Text -> (Text, Text) Source #

O(n) The partition function takes a predicate, a text, returns a pair of text with codepoints which do and do not satisfy the predicate, respectively; i.e.,

partition p txt == (filter p txt, filter (not . p) txt)