
17 Feb
2008
17 Feb
'08
1:47 a.m.
"Cale" == Cale Gibbard
writes:
Cale> So, the first version: Cale> import System.IO import Control.Exception (try) Cale> main = do mfh <- try (openFile "myFile" ReadMode) case mfh Cale> of Left err -> do putStr "Error opening file for reading: " Cale> print err Right fh -> do mline <- try (hGetLine fh) case Cale> mline of Left err -> do putStr "Error reading line: " print Cale> err hClose fh Right line -> putStrLn ("Read: " ++ line) Left? Right? Hardly descriptive terms. Sounds like a sinister language to me. -- Colin Adams Preston Lancashire