I'm currently writing a basic console application in Haskell, and I wanted to make it obvious to the user when they're being asked for input by putting >
at the beginning of the line. Sounds simple enough, right?
Consider this bit of code:
main :: IO ()
main = do
putStr "\nSay something:\n> "
input <- getLine
putStrLn ("You said " ++ input)
This works perfectly as intended when executed in ghci, however when I compile and run the program, now this happens:
Say something:
something
> You said something
Can someone please explain to me how and why this difference in behavior arises, and how I should go about achieving the result I have in mind?