I know I can do the following from a command prompt:
$ runghc WC < quux.txt
How do I do this in WinGHCi? I know I have to first load the file like this:
Prelude> :load WC
But then what? This doesn't work:
*Main> WC < quux.txt
<interactive>:1:1: Not in scope: data constructor `WC'
<interactive>:1:6: Not in scope: `quux'
<interactive>:1:11: Not in scope: `txt'
Look at the IO routines provided:
http://www.haskell.org/tutorial/io.html
Another place to look is:
http://book.realworldhaskell.org/read/io.html
I think you need to write your program differently. WC should be parameterized by the file handle. Then you can do wc (openFile "quux.txt" ReadMode)
at GHCi. Then you define your main function as main = wc stdin
to keep the input redirection at the command prompt working.