I'm also confused about the formatting of the example in the book (page 72). The last line ("myFunction = id") seems to be indented between the where and the next line, why is that? Is that simply a layout problem? To me, it seems it should be on the same level as the where.
-- Interact.hs, simple filter in Haskell
import System.Environment (getArgs)
interactWith function inputFile outputFile = do
input <- readFile inputFile
writeFile outputFile (function input)
main = mainWith myFunction
where mainWith function = do
args <- getArgs
case args of
[input, output] -> interactWith function input output
_ -> putStrLn "Usage: Interact inputFile outputFile"
myFunction = id
Regards,
Robert