Hi Serge, > 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 ?
'Data.Map.lookup' has the return type 'm a', that is returns the value within an arbitrary monad of type m, which need not even be a member of the class 'Show'. You need to further specify the type of the monad. '(Data.Map.lookup 'a' $ Data.Map.singleton 'a' 'b')::Maybe Char' does what you expect. Regards, Jens _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users