-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Filters a list based on a fuzzy string search. -- -- Filters a list based on a fuzzy string search. @package fuzzy @version 0.1.0.1 -- | Fuzzy string search in Haskell. Uses TextualMonoid to be able -- to run on different types of strings. module Text.Fuzzy -- | Included in the return type of match and -- filter. Contains the original value given, the -- rendered string and the matching score. data (TextualMonoid s) => Fuzzy t s Fuzzy :: t -> s -> Int -> Fuzzy t s [original] :: Fuzzy t s -> t [rendered] :: Fuzzy t s -> s [score] :: Fuzzy t s -> Int -- | Returns the rendered output and the matching score for a pattern and a -- text. Two examples are given below: -- --
-- >>> match "fnt" "infinite" "" "" id True
-- Just ("infinite",3)
--
--
--
-- >>> match "hsk" ("Haskell",1995) "<" ">" fst False
-- Just ("<h>a<s><k>ell",5)
--
match :: TextualMonoid s => s -> t -> s -> s -> (t -> s) -> Bool -> Maybe (Fuzzy t s)
-- | The function to filter a list of values by fuzzy search on the text
-- extracted from them.
--
--
-- >>> filter "ML" [("Standard ML", 1990),("OCaml",1996),("Scala",2003)] "<" ">" fst False
-- [Fuzzy {original = ("Standard ML",1990), rendered = "standard <m><l>", score = 4},Fuzzy {original = ("OCaml",1996), rendered = "oca<m><l>", score = 4}]
--
filter :: TextualMonoid s => s -> [t] -> s -> s -> (t -> s) -> Bool -> [Fuzzy t s]
-- | Return all elements of the list that have a fuzzy match against the
-- pattern. Runs with default settings where nothing is added around the
-- matches, as case insensitive.
--
-- -- >>> simpleFilter "vm" ["vim", "emacs", "virtual machine"] -- ["vim","virtual machine"] --simpleFilter :: TextualMonoid s => s -> [s] -> [s] -- | Returns false if the pattern and the text do not match at all. Returns -- true otherwise. -- --
-- >>> test "brd" "bread" -- True --test :: TextualMonoid s => s -> s -> Bool instance (Data.Monoid.Textual.TextualMonoid s, GHC.Classes.Eq t, GHC.Classes.Eq s) => GHC.Classes.Eq (Text.Fuzzy.Fuzzy t s) instance (Data.Monoid.Textual.TextualMonoid s, GHC.Show.Show t, GHC.Show.Show s) => GHC.Show.Show (Text.Fuzzy.Fuzzy t s)