Data.Map lookup signature

Hi everyone. The docs in the web on http://www.haskell.org/ghc/docs define Data.Map.lookup as follows: http://www.haskell.org/ghc/docs lookup :: Ord k => k -> Map k a -> Maybe a but my version of ghci does i like that: Data.Map.lookup :: (Ord k, Monad m) => k -> Data.Map.Map k a -> m a but i need the 1. one. my version of ghci is 6.8.2 regards

Oh sorry.
It was probalby changed in one of the latest versions
I downloaded the latest and now i'm finde.
2009/5/11 Nico Rolle
Hi everyone.
The docs in the web on http://www.haskell.org/ghc/docs define Data.Map.lookup as follows: http://www.haskell.org/ghc/docs lookup :: Ord k => k -> Map k a -> Maybe a but my version of ghci does i like that: Data.Map.lookup :: (Ord k, Monad m) => k -> Data.Map.Map k a -> m a but i need the 1. one. my version of ghci is 6.8.2 regards

Maybe is an instance of Monad; the second signature is just more
general than the first.
class Monad m where
return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b
fail :: String -> m a
Map lookup only uses "return" and "fail"; for Maybe these are defined
as follows:
return x = Just x
fail s = Nothing
So it's really the same thing.
-- ryan
On Mon, May 11, 2009 at 8:37 AM, Nico Rolle
Hi everyone.
The docs in the web on http://www.haskell.org/ghc/docs define Data.Map.lookup as follows: http://www.haskell.org/ghc/docs lookup :: Ord k => k -> Map k a -> Maybe a but my version of ghci does i like that: Data.Map.lookup :: (Ord k, Monad m) => k -> Data.Map.Map k a -> m a but i need the 1. one. my version of ghci is 6.8.2 regards _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Nico Rolle
-
Ryan Ingram