
12 Aug
2010
12 Aug
'10
10:09 a.m.
The file "error_puzzle.hs" begins like this: main = do inp <- readFile "input" writeFile "output" $ process inp process :: String -> String When compiled with GHC 6.12.3 and run, it gives the following result: $ ./error_puzzle error_puzzle: output: hClose: illegal operation (handle is finalized) What is the cause of the error? Give a definition for process and an input file that reproduce this result. No "unsafe" functions like unsafePerformIO are allowed. Have fun! -Yitz