-- 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.0


-- | Fuzzy string search in Haskell. Uses <tt>TextualMonoid</tt> to be able
--   to run on different types of strings.
module Text.Fuzzy

-- | Included in the return type of <tt><a>match</a></tt> and
--   <tt><a>filter</a></tt>. 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:
--   
--   <pre>
--   &gt;&gt;&gt; match "fnt" "infinite" "" "" id True
--   Just ("infinite",3)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; match "hsk" ("Haskell",1995) "&lt;" "&gt;" fst False
--   Just ("&lt;h&gt;a&lt;s&gt;&lt;k&gt;ell",5)
--   </pre>
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.
--   
--   <pre>
--   &gt;&gt;&gt; filter "ML" [("Standard ML", 1990),("OCaml",1996),("Scala",2003)] "&lt;" "&gt;" fst False
--   [Fuzzy {original = ("Standard ML",1990), rendered = "standard &lt;m&gt;&lt;l&gt;", score = 4},Fuzzy {original = ("OCaml",1996), rendered = "oca&lt;m&gt;&lt;l&gt;", score = 4}]
--   </pre>
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.
--   
--   <pre>
--   &gt;&gt;&gt; simpleFilter "vm" ["vim", "emacs", "virtual machine"]
--   ["vim","virtual machine"]
--   </pre>
simpleFilter :: (TextualMonoid s) => s -> [s] -> [s]

-- | Returns false if the pattern and the text do not match at all. Returns
--   true otherwise.
--   
--   <pre>
--   &gt;&gt;&gt; test "brd" "bread"
--   True
--   </pre>
test :: (TextualMonoid s) => s -> s -> Bool
instance (GHC.Classes.Eq s, GHC.Classes.Eq t, Data.Monoid.Textual.TextualMonoid s) => GHC.Classes.Eq (Text.Fuzzy.Fuzzy t s)
instance (GHC.Show.Show s, GHC.Show.Show t, Data.Monoid.Textual.TextualMonoid s) => GHC.Show.Show (Text.Fuzzy.Fuzzy t s)
