[Help] How to input string in Haskell for mac?


[Help] How to input string in Haskell for mac?

Hi guys, I'm a noob to haskell coming for python and I would like to learn the language. However, I wanted to test some interactive programs so that I could practice somewhere that uses input and output like codechef and hackerrank. I'm looking for the equivalent to input() in python using Haskell for mac.

let main = do putStrLn "Greetings! What is your name?" inpStr <- getLine putStrLn $"Welcome to Haskell, " ++ inpStr ++ "!" main 

But I keep getting the error: Exception: <stdin>: hGetLine: illegal operation (handle is closed)

Any ideas?

Submitted June 24, 2017 at 08:32PM by jadenpls
via reddit http://ift.tt/2s2HsGf