
On Thu, 6 May 2010 15:07:30 +1000
Ivan Miljenovic
On 6 May 2010 15:01,
wrote: I was doing the following:
do status <- mapM PF.getFileStatus filenames let times = map PF.modificationTime status let sorted = sortBy (\(_, t1) (_,t2) -> compare t1 t2) (zip filenames times)
times <- mapM (liftM PF.modificationTime . PF.getFileStatus) filenames
However, I'd be tempted to leave it as is (and hope/assume that fusion does its magic).
well now it's obvious :-) I did have liftM in there, but just couldn't quite figure out how to tie things together. to be completely clear : liftM takes modificationTime from Status -> EpochTime to IO Status -> IO EpochTime so now it can operate on the results of getFileStatus, which returns `IO Status`. mapM gathers the [IO EpochTime] into `IO [EpochTime]` and then <- gives [EpochTime]. It's a little more clear in the verbose form, isn't it ? Thanks ! Brian