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

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to