
Hi, Recently, I need to write the following code: getModTime :: Maybe FilePath -> IO (Maybe UTCTime) getModTime mfile = case mfile of Nothing -> return Nothing Just file -> Just <$> getModificationTime file I feel that this is redundant. So, I used 'traverse' instead: getModTime :: Maybe FilePath -> IO (Maybe UTCTime) getModTime mfile = getModificationTime `traverse` mfile First, I would like to know whether or not this is a good coding style. Second, if this is acceptable, why don't we define an operator? For instance, (<:>) :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) (<:>) = traverse getModTime :: Maybe FilePath -> IO (Maybe UTCTime) getModTime mfile = getModificationTime <:> mfile Is there such an operator already? Regards, --Kazu