Hello, This multipart tutorial seems similar to what you are describing:
http://blog.moertel.com/articles/2007/03/28/directory-tree-printing-in-haskell-part-three-lazy-i-o The tutorial is actually a bit more complicated, it is traversing a whole directory tree and printing a nice graph. HTH, j. At Mon, 9 Apr 2007 10:46:14 +0800, Albert Lee wrote: > > Newbie's question: I want to ls the filenames of a directory. The program in > C is something like: > > #include <direnet.h> > > int main(){ > DIR *dp; > struct dirent *dirp; > > dp = opendir("/"); > > while((dirp = readdir(dp)) != NULL) > printf("%s\n", dirp->d_name); > > closedir(dp); > } > > > and I write that in haskell: > > ----- > import System.Posix > import System.IO > > main = do > dp <- openDirStream "/" > df <- readDirStream dp > putStrLn df > closeDirStream dp > > > ------ > It can print the first entry of the dir, but how can we list it all like the > C prog? map ? list comperhension? _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
