--- | Deletes from the left argument any bindings in the right argument
-minusFM :: (Ord key)
- => FiniteMap key elt -> FiniteMap key elt -> FiniteMap key elt
-
-intersectFM :: (Ord key)
- => FiniteMap key elt -> FiniteMap key elt -> FiniteMap key elt
--- | Combines bindings for the same thing in the two maps with the given function
-intersectFM_C :: (Ord key)
- => (elt1 -> elt2 -> elt3)
- -> FiniteMap key elt1 -> FiniteMap key elt2
- -> FiniteMap key elt3
-
--- MAPPING, FOLDING, FILTERING
-foldFM :: (key -> elt -> a -> a) -> a -> FiniteMap key elt -> a
-mapFM :: (key -> elt1 -> elt2)
- -> FiniteMap key elt1 -> FiniteMap key elt2
-filterFM :: (Ord key)
- => (key -> elt -> Bool)
- -> FiniteMap key elt -> FiniteMap key elt
-
--- INTERROGATING
-sizeFM :: FiniteMap key elt -> Int
-isEmptyFM :: FiniteMap key elt -> Bool
-
-elemFM :: (Ord key)
- => key -> FiniteMap key elt -> Bool
-lookupFM :: (Ord key)
- => FiniteMap key elt -> key -> Maybe elt
--- | Supplies a "default" element in return for an unmapped key
-lookupWithDefaultFM :: (Ord key)
- => FiniteMap key elt -> elt -> key -> elt
-
--- LISTIFYING
-fmToList :: FiniteMap key elt -> [(key,elt)]
-keysFM :: FiniteMap key elt -> [key]
-eltsFM :: FiniteMap key elt -> [elt]
-\end{code}
-
-%************************************************************************
-%* *
-\subsection{Implementation using ``Data.Map''}
-%* *
-%************************************************************************
-
-\begin{code}
-newtype FiniteMap key elt = FM (M.Map key elt)
-
-emptyFM = FM M.empty
-unitFM k v = FM (M.singleton k v)
-listToFM l = FM (M.fromList l)
-
-addToFM (FM m) k v = FM (M.insert k v m)
--- Arguments of combining function of M.insertWith and addToFM_C are flipped.
-addToFM_C f (FM m) k v = FM (M.insertWith (flip f) k v m)
-addListToFM = foldl (\m (k, v) -> addToFM m k v)
-addListToFM_C f = foldl (\m (k, v) -> addToFM_C f m k v)
-delFromFM (FM m) k = FM (M.delete k m)
-delListFromFM = foldl delFromFM
-
--- M.union is left-biased, plusFM should be right-biased.
-plusFM (FM x) (FM y) = FM (M.union y x)
-plusFM_C f (FM x) (FM y) = FM (M.unionWith f x y)
-minusFM (FM x) (FM y) = FM (M.difference x y)
-#if MIN_VERSION_containers(0,4,0)
-foldFM k z (FM m) = M.foldrWithKey k z m