Re: [Haskell-cafe] unexpected behavior from filterM doesFileExist =<< getDirectoryContents
Thanks, that was it. Dud question. 2010/1/9 Brandon S. Allbery KF8NH : > On Jan 10, 2010, at 00:24 , Thomas Hartman wrote: >> >> Can somebody explain this? >> >>> getDirectoryContents inD >> >> ["..","#sanity >> .txt >> #",".","sanity >> .txt >> ","etc >> .txt >> ","patchTagDir >> .txt >> ","jail >> .txt","notjail.txt","alldata.txt","allobjs.txt","namesNSizes.txt"] >> >>> filterM doesFileExist =<< getDirectoryContents inD >> >>> ["sanity.txt"] > > > My first guess is that inD isn't "."; getDirectoryContents doesn't fully > qualify the names it returns, so doesFileExist looks in the current > directory for the bare names returned. > > -- > brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com > system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu > electrical and computer engineering, carnegie mellon university KF8NH > > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] unexpected behavior from filterM doesFileExist =<< getDirectoryContents
On Jan 10, 2010, at 00:24 , Thomas Hartman wrote: Can somebody explain this? getDirectoryContents inD ["..","#sanity .txt #",".","sanity .txt ","etc .txt ","patchTagDir .txt ","jail .txt","notjail.txt","alldata.txt","allobjs.txt","namesNSizes.txt"] filterM doesFileExist =<< getDirectoryContents inD ["sanity.txt"] My first guess is that inD isn't "."; getDirectoryContents doesn't fully qualify the names it returns, so doesFileExist looks in the current directory for the bare names returned. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH PGP.sig Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] unexpected behavior from filterM doesFileExist =<< getDirectoryContents
Can somebody explain this? > getDirectoryContents inD ["..","#sanity.txt#",".","sanity.txt","etc.txt","patchTagDir.txt","jail.txt","notjail.txt","alldata.txt","allobjs.txt","namesNSizes.txt"] > filterM doesFileExist =<< getDirectoryContents inD > ["sanity.txt"] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe