[Haskell-cafe] mixing map and mapM ?

Ivan Miljenovic ivan.miljenovic at gmail.com
Thu May 6 01:07:30 EDT 2010


On 6 May 2010 15:01,  <briand at aracnet.com> 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).

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list