Make Control.Exception buildable by nhc98.
[haskell-directory.git] / Data / Set.hs
index fd80ca6..9ec9e4c 100644 (file)
@@ -9,10 +9,11 @@
 --
 -- An efficient implementation of sets.
 --
--- This module is intended to be imported @qualified@, to avoid name
--- clashes with "Prelude" functions.  eg.
+-- Since many function names (but not the type name) clash with
+-- "Prelude" names, this module is usually imported @qualified@, e.g.
 --
--- >  import Data.Set as Set
+-- >  import Data.Set (Set)
+-- >  import qualified Data.Set as Set
 --
 -- The implementation of 'Set' is based on /size balanced/ binary trees (or
 -- trees of /bounded balance/) as described by:
@@ -745,18 +746,15 @@ deleteFindMax t
 
 -- | /O(log n)/. Retrieves the minimal key of the set, and the set stripped from that element
 -- @fail@s (in the monad) when passed an empty set.
-minView :: Monad m => Set a -> m (Set a, a)
+minView :: Monad m => Set a -> m (a, Set a)
 minView Tip = fail "Set.minView: empty set"
-minView x = return (swap $ deleteFindMin x)
+minView x = return (deleteFindMin x)
 
 -- | /O(log n)/. Retrieves the maximal key of the set, and the set stripped from that element
 -- @fail@s (in the monad) when passed an empty set.
-maxView :: Monad m => Set a -> m (Set a, a)
+maxView :: Monad m => Set a -> m (a, Set a)
 maxView Tip = fail "Set.maxView: empty set"
-maxView x = return (swap $ deleteFindMax x)
-
-swap (a,b) = (b,a)
-
+maxView x = return (deleteFindMax x)
 
 
 {--------------------------------------------------------------------