Dost
Dost

Reputation: 33

Haskell calling a file has input

Imagine that I have compiled the file program.hs where:

main :: IO ()
main = do a <- getArgs 
          w <- getContents
...

My question is how can I run that program in the windows command line such that it receives input from file.txt?

Upvotes: 0

Views: 106

Answers (1)

Use the < input redirection operator when running the program:

program otherargumentsgohere < inputfile.txt

Upvotes: 2

Related Questions