9 Apr
2001
9 Apr
'01
7:42 a.m.
mapple apple schrieb folgendes am Sat, Apr 07, 2001 at 02:36:50PM +1000:
main :: IO () main = do putStr "Filename plz: " file <- getLine content <- readFile file putStr ("1: " ++ read (show (head (lines content)))) and so on
Try: number start [] = [] number start [line:lines] = [(show start) ++ ": " ++ line : number (start + 1) lines] main = do putStr "Filename plz: " file <- getLine content <- readFile file putStr (unlines (number 1 (lines content))) You should do most of the computations in the functional style and not in the IO Monad. -- Stefan Karrmann