Instances2Eq, Show
(TextualMonoid s, Eq t, Eq s) => Eq (Fuzzy t s)Defined in fuzzy-0.1.1.0 · Text.Fuzzy(TextualMonoid s, Show t, Show s) => Show (Fuzzy t s)Defined in fuzzy-0.1.1.0 · Text.Fuzzy
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulefuzzy-0.1.1.0Haskell2010
Fuzzy string search in Haskell.
Uses TextualMonoid to be able to run on different types of strings.
(TextualMonoid s, Eq t, Eq s) => Eq (Fuzzy t s)Defined in fuzzy-0.1.1.0 · Text.Fuzzy(TextualMonoid s, Show t, Show s) => Show (Fuzzy t s)Defined in fuzzy-0.1.1.0 · Text.Fuzzymatch :: TextualMonoid s=> sPattern.
-> tThe value containing the text to search in.
-> sThe text to add before each match.
-> sThe text to add after each match.
-> (t -> s)The function to extract the text from the container.
-> BoolCase sensitivity.
-> Maybe (Fuzzy t s)The original value, rendered string and score.
Returns the rendered output and the matching score for a pattern and a text. Two examples are given below:
match "fnt" "infinite" "" "" id TrueJust ("infinite",3)
match "hsk" ("Haskell",1995) "<" ">" fst FalseJust ("<H>a<s><k>ell",5)
filter :: TextualMonoid s=> sPattern.
-> [t]The list of values containing the text to search in.
-> sThe text to add before each match.
-> sThe text to add after each match.
-> (t -> s)The function to extract the text from the container.
-> BoolCase sensitivity.
-> [Fuzzy t s]The list of results, sorted, highest score first.
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}]
simpleFilter :: TextualMonoid s=> sPattern to look for.
-> [s]List of texts to check.
-> [s]The ones that match.
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"]
Returns false if the pattern and the text do not match at all. Returns true otherwise.
test "brd" "bread"True