This way :

do
        times<-mapM PF.getFileStatus filenames >>= return.(map 
PF.modificationTime)

Or also :

do
        times<-mapM (PF.getFileStatus >>= (return.(PF.modificationTime))) 
filenames
        let sorted=...

I do not know exactly how ghc compiles the IO monad, but it seems to me that 
the latter would allocate a little less.

Cheers,
PE

El 06/05/2010, a las 01:01, <bri...@aracnet.com> <bri...@aracnet.com> escribió:

> 
> 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)
> 
> and I thought, surely I can combine the status and times definitions into one 
> line, only I can't.
> 
> Hint ?
> 
> Thanks,
> 
> Brian
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to