HaskellFan
HaskellFan

Reputation: 3

Haskell read multiple files

I'm trying to read multiples files at once using the following code. The code compiles, however when executed I get the following exception:

*** Exception: ..: openFile: permission denied (Permission denied).

I have all the permissions as system administrator. Also, I was able to do the same in C# with no problem, meaning/suspecting that it's an issue with the code itself.

Thanks for help.

main :: IO()
main = do 
   putStrLn " Enter file path:"
   content <- getLine >>= getDirectoryContents
   x <- mapM readFile content
   print x

Upvotes: 0

Views: 611

Answers (1)

Arnon
Arnon

Reputation: 2237

Are you sure all of the files are actually files? It looks like you're trying to open a file called ...

Filter the results to only include actual files first.

Upvotes: 5

Related Questions