
Dear All, as a newbie, I am only just discovering some intricacies of haskell. I have a Data.Map map, and am trying the lookup function to get the value for a given key (it is a list in my case, btw). I am struggling to get access to the value, as it is constructed using Just. I know that the question is therefore more general then the application on Map, so I would be glad to get a wider picture. I Checked in Real World Haskell, btu did nto find and answer. In Haskell the craft of... I found the following (p263): mapValue :: (a->b)-> Maybe a -> Maybe b mapValue g (Just a) = Just (g a) mapValue g Nothing = Nothing Which is fine, but it makes the Just constructor travel through the whole code, which is annoying. Is there a way out? Or would that be a dirty hack? I do not quite understand the following discussion of maybe (p263-4), but it seems like the code suggested is able to return a value at the end... Thanks Martin