I am trying to create an interactive Haskell program using function interactc map.
This is what I get in ghci (as far as I can tell, since all the tutorials explain the use interact- except the result).
*Module> interact $ unlines . map (++ "!") . lines
tteesstt
!
Please note that what is actually happening is that every character that I type instantly repeats, and after pressing the Return button an exclamation mark appears. I, however, expected this:
*Module> interact $ unlines . map (++ "!") . lines
test
test!
It works fine if I use the same program structure, but filterinstead map.
source
share