Map.lookup in 6.4.1

Serge D. Mechveliani mechvel at botik.ru
Thu Aug 10 06:07:51 EDT 2006


Please, what is the matter with  Map.lookup ?

In  ghc-6.4.1,  I try

-------------------------------
> ghci -package base
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.4.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.

Prelude> Data.Map.singleton 'a' 'b'
{'a':='b'}

Prelude> Data.Map.lookup 'a' $ Data.Map.singleton 'a' 'b'

Prelude>
-------------------------------

Must not it print  Just 'b'  instead of printing emptyness? 
Further:

----------
Prelude> Data.Map.lookup 'b' $ Data.Map.singleton 'a' 'b'

*** Exception: user error (Data.Map.lookup: Key not found)
----------

Instead, must not it print  Nothing  ?

Thank you in advance for explanation,

-----------------
Serge Mechveliani
mechvel at botik.ru


More information about the Glasgow-haskell-users mailing list