Safe Haskell | None |
---|---|
Language | Haskell2010 |
A term index to accelerate matching. An index is a multimap from terms to arbitrary values.
The type of query supported is: given a search term, find all keys such that the search term is an instance of the key, and return the corresponding values.
- data Index f a
- empty :: Index f a
- null :: Index f a -> Bool
- singleton :: Term f -> a -> Index f a
- insert :: Term f -> a -> Index f a -> Index f a
- delete :: Eq a => Term f -> a -> Index f a -> Index f a
- lookup :: (Has a b, Symbolic b, Has b (TermOf b)) => TermOf b -> Index (ConstantOf b) a -> [b]
- matches :: Has a (Term f) => Term f -> Index f a -> [(Subst f, a)]
- approxMatches :: Term f -> Index f a -> [a]
- elems :: Index f a -> [a]
Documentation
A term index: a multimap from
to Term
fa
.
lookup :: (Has a b, Symbolic b, Has b (TermOf b)) => TermOf b -> Index (ConstantOf b) a -> [b] Source #
Look up a term in the index. Finds all key-value such that the search term is an instance of the key, and returns an instance of the the value which makes the search term exactly equal to the key.
matches :: Has a (Term f) => Term f -> Index f a -> [(Subst f, a)] Source #
Look up a term in the index. Like lookup
, but returns the exact value
that was inserted into the index, not an instance. Also returns a substitution
which when applied to the value gives you the matching instance.
approxMatches :: Term f -> Index f a -> [a] Source #
Look up a term in the index, possibly returning spurious extra results.