-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Filters a list based on a fuzzy string search -- -- Fuzzily is a library that filters a list based on a fuzzy string -- search. Uses TextualMonoid to be able to run on different types -- of strings. @package fuzzily @version 0.1.0.0 -- | Fuzzy string search in Haskell. Uses TextualMonoid to be able -- to run on different types of strings. module Text.Fuzzily -- | Included in the return type of match and filter. -- Contains the original value given, the rendered string and the -- matching score. data Fuzzy val prettyText Fuzzy :: val -> prettyText -> Int -> Fuzzy val prettyText [original] :: Fuzzy val prettyText -> val [rendered] :: Fuzzy val prettyText -> prettyText [score] :: Fuzzy val prettyText -> Int data CaseSensitivity IgnoreCase :: CaseSensitivity HandleCase :: CaseSensitivity null :: TextualMonoid s => s -> Bool -- | Returns the rendered output and the matching score for a pattern and a -- text. Two examples are given below: -- --
--   >>> match HandleCase ("", "") identity "fnt" "infinite"
--   Just (Fuzzy
--     { original = "infinite"
--     , rendered = "infinite"
--     , score = 3
--     })
--   
-- --
--   >>> match IgnoreCase ("<", ">") fst "hsk" ("Haskell", 1995)
--   Just (Fuzzy
--     { original = ("Haskell", 1995)
--     , rendered = "<h>a<s><k>ell"
--     , score = 5
--     })
--   
match :: TextualMonoid text => CaseSensitivity -> (text, text) -> (value -> text) -> text -> value -> Maybe (Fuzzy value text) -- | The function to filter a list of values by fuzzy search on the text -- extracted from them. -- --
--   >>> langs = [("Standard ML", 1990), ("OCaml", 1996), ("Scala", 2003)]
--   
--   >>> filter "ML" langs ("<", ">") fst IgnoreCase
--   [ Fuzzy
--     { original = ("Standard ML", 1990)
--     , rendered = "standard <m><l>"
--     , score = 4}
--   , Fuzzy
--     { original = ("OCaml", 1996)
--     , rendered = "oca<m><l>"
--     , score = 4
--     }
--   ]
--   
filter :: TextualMonoid text => CaseSensitivity -> (text, text) -> (value -> text) -> text -> [value] -> [Fuzzy value text] -- | 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 text => text -> [text] -> [text] -- | Returns false if the pattern and the text do not match at all. Returns -- true otherwise. -- --
--   >>> test "brd" "bread"
--   True
--   
test :: TextualMonoid text => text -> text -> Bool instance (GHC.Classes.Eq val, GHC.Classes.Eq prettyText) => GHC.Classes.Eq (Text.Fuzzily.Fuzzy val prettyText) instance (GHC.Show.Show val, GHC.Show.Show prettyText) => GHC.Show.Show (Text.Fuzzily.Fuzzy val prettyText) instance GHC.Classes.Eq Text.Fuzzily.CaseSensitivity instance GHC.Show.Show Text.Fuzzily.CaseSensitivity