From bab409e3e1fc39b20954cc4f67a112cffe09ff7e Mon Sep 17 00:00:00 2001 From: "jeanphilippe.bernardy@gmail.com" Date: Sun, 3 Sep 2006 13:34:40 +0000 Subject: [PATCH] Better doc on Data.Map.lookup: explain what the monad is for --- Data/Map.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Data/Map.hs b/Data/Map.hs index da83cf2..6c95dc0 100644 --- a/Data/Map.hs +++ b/Data/Map.hs @@ -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 -- 1.7.10.4