What I want is to write a Haskell function to return the files of current directory e.g
Change the current directory to
:cd c:/code/haskell
Then write a function which returns the files in a set e.g
[x | x <-getDirectoryContents ]
Edited:
I have wrote a function sth like this which lists files
(ref: http://zvon.org/other/haskell/Outputdirectory/index.html)
import Directory
main = _dir "/tmp/FOO"
_dir _path =do
setCurrentDirectory _path
_cd <- getCurrentDirectory
print _cd
_file <- getDirectoryContents _cd
print _file
so calling _dir “c:/code/haskell” will list all files + directory names (non-recursive) . What I want now is to call this in a predicate function, for example:
[ x| x <- _dir "c:/code/haskell" | x start with 'haskell_' ]
so I can apply a filter on file name
It seems you are looking for:
Refer : http://www.haskell.org/ghc/docs/6.12.2/html/libraries/directory-1.0.1.1/System-Directory.html#1