I am trying to practise declarative programming using Haskell, I am running into some confusion with the interact function.
I can see from its type signature it operates on a whole string at once:
interact :: (String -> String) -> IO ()
What is the value of the string for a multiline input? I assume that it is a single string with a newline character inside of it?
For a Haskell program Main.hs
module Main where
main :: IO ()
main = interact( ... )
and a input file input.txt
5 6 7
3 6 10
If I run the compiled program like this:
$ Main < input.txt
Would the string that the interact is working with be:
5 6 7\n3 6 10