import System.IO
fileName = "data.txt"
main = do
putStr "Enter Point :"
information <- getLine
let final = ['\n'] ++ information
appendFile fileName final
putStrLn "Done !"
Successful compilation but there is a runtime error : Program asks for input first then executes the putStr function.
hello
Enter Point :Done !
I think there should be an explanation of why Haskell isn't following the sequence (maybe it's because of its functional nature). Any explanation will be highly appreciated ! ( I am new to functional paradigm )