I am trying to write a simple cat
program in Haskell. I would like to take multiple filenames as arguments, and write each file sequentially to STDOUT>
catHandle
, which is indirectly called from catFileArray
, calls exitWith when it reaches the end of the first file. This terminates the program, and further files aren't read anymore.
You should instead just return normally from the catHandle
function when the end of the file has been reached. This probably means you shouldn't do the reading forever
.