Better doc on Data.Map.lookup: explain what the monad is for
authorjeanphilippe.bernardy@gmail.com <unknown>
Sun, 3 Sep 2006 13:34:40 +0000 (13:34 +0000)
committerjeanphilippe.bernardy@gmail.com <unknown>
Sun, 3 Sep 2006 13:34:40 +0000 (13:34 +0000)
Data/Map.hs

index da83cf2..6c95dc0 100644 (file)
@@ -250,7 +250,12 @@ size t
       Bin sz k x l r  -> sz
 
 
--- | /O(log n)/. Lookup the value at a key in the map.
+-- | /O(log n)/. Lookup the value at a key in the map. 
+--
+-- The function will 
+-- @return@ the result in the monad or @fail@ in it the key isn't in the 
+-- map. Often, the monad to use is 'Maybe', so you get either 
+-- @('Just' result)@ or @'Nothing'@.
 lookup :: (Monad m,Ord k) => k -> Map k a -> m a
 lookup k t = case lookup' k t of
     Just x -> return x