$ runhaskell mixi100116.hs mixi100116.hs
1: import System
2:
3: main = do
4: file:_ <- getArgs
5: content <- readFile file
6: mapM_ putStrLn $ withNum 1 $ lines content
7: where
8: withNum n [] = []
9: withNum n (x:xs) = ((show n) ++ ": " ++ x) : (withNum (n+1) xs)
追記
zipWithがあるじゃないか。忘れてた。
1: import System
2:
3: main = do
4: file:_ <- getArgs
5: content <- readFile file
6: mapM_ putStrLn $ zipWith (\n x -> show n ++ ": " ++ x) [1..] (lines content)
数字の連番くっつけたいときはそういうリストを用意してまぜ合わせる。