-- | Create an index from a list of items
fromListWith :: (a -> Term f) -> [a] -> Index f a
fromListWith f xs = foldr (\x -> insert (f x) x) empty xs
fromListWith :: (a -> Term f) -> [a] -> Index f a
fromListWith f xs = foldr (\x -> insert (f x) x) empty xs
fromListWith f xs = foldr (\x -> insert (f x) x) empty xs