License | GPL-2 |
---|---|
Maintainer | yi-devel@googlegroups.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Extensions |
|
Collection of functions for completion and matching.
- completeInList :: Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text
- completeInList' :: Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text
- completeInListCustomShow :: (Text -> Text) -> Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text
- commonPrefix :: Eq a => [[a]] -> [a]
- prefixMatch :: Text -> Text -> Maybe Text
- infixMatch :: Text -> Text -> Maybe Text
- subsequenceMatch :: String -> String -> Bool
- containsMatch' :: Bool -> Text -> Text -> Maybe Text
- containsMatch :: Text -> Text -> Maybe Text
- containsMatchCaseInsensitive :: Text -> Text -> Maybe Text
- mkIsPrefixOf :: Bool -> Text -> Text -> Bool
Documentation
:: Text | Input to match on |
-> (Text -> Maybe Text) | matcher function |
-> [Text] | items to match against |
-> EditorM Text |
Complete a string given a user input string, a matching function and a list of possibilites. Matching function should return the part of the string that matches the user string.
completeInListCustomShow Source #
:: (Text -> Text) | Show function |
-> Text | Input to match on |
-> (Text -> Maybe Text) | matcher function |
-> [Text] | items to match against |
-> EditorM Text |
Same as completeInList
, but maps showFunction
on possible
matches when printing
commonPrefix :: Eq a => [[a]] -> [a] #
Return the longest common prefix of a set of lists.
P(xs) === all (isPrefixOf (commonPrefix xs)) xs length s > length (commonPrefix xs) --> not (all (isPrefixOf s) xs)
prefixMatch :: Text -> Text -> Maybe Text Source #
Prefix matching function, for use with completeInList
infixMatch :: Text -> Text -> Maybe Text Source #
Infix matching function, for use with completeInList
containsMatch' :: Bool -> Text -> Text -> Maybe Text Source #
TODO: this is a terrible function, isn't this just case-insensitive infix? – Fūzetsu
Like usual isPrefixOf
but user can specify case sensitivity.
See toCaseFold
for exotic unicode gotchas.