Pidaji
Pidaji

Reputation: 45

Haskell error on text file as input on Mac

I have a Main.hs file with two functions.

Module Main where
import Data.List
main :: IO()
main              = interact reverse
functionThatWorks = putStrLn "Ajax"

After I set the directory and load Main.hs I have no problem with calling functionThatWorks. Except when I want to take a text file as input like so:

Main<in.txt or ./Main<in.txt

I get an error saying 'parse error on input 'in' ' Does anyone know I can make this work in the Terminal?

p.s. I use a Mac.

Upvotes: 0

Views: 70

Answers (1)

ErikR
ErikR

Reputation: 52057

Unfortunately ghci doesn't understand input redirection like the shell does.

I would suggest running your program with runhaskell:

runhaskell Main.hs < in.txt

Upvotes: 4

Related Questions