
5 Dec
2010
5 Dec
'10
6:23 a.m.
Hi Haskellers, I have another simple question in order to improve my coding style. I'm using the following function, e.g. when a dialog returned Maybe NiceStuff: performMaybe :: Monad m ⇒ Maybe a → (a → m b) → m () performMaybe x action = when (isJust x) (action (fromJust x) >> return ()) example use: main = performMaybe (Just "Hello") print Now I wonder if others use such a function as well, if it's already defined in the standard libraries (didn't find it using Hoogle) and perhaps how to implement it a little nicer. Regards Tim