module Language.Distance.Search.Class (Search (..)) where
import Data.ListLike (ListLike)
import Language.Distance
class Search container full algo | container -> full, container -> algo where
empty :: container
insert :: full -> container -> container
query :: Int
-> full
-> container
-> [(full, Distance algo)]
singleton :: full -> container
singleton str = insert str empty
member :: full -> container -> Bool
member x = not . null . query 0 x
fromList :: [full] -> container
fromList = foldr insert empty