Created
October 12, 2012 08:49
-
-
Save oconnor663/3878147 to your computer and use it in GitHub Desktop.
nl.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Environment | |
import Control.Monad | |
addNumbers strs = zipWith (\a b -> show a ++ " " ++ b) [1..] strs | |
main = do | |
args <- getArgs | |
text <- if length args > 0 | |
then readFile (head args) | |
else getContents | |
putStr $ unlines $ addNumbers $ lines text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment