main::IO()
main = do
        args <- getArgs
        out <- case length args of 
                0 -> error "Usage: wordcount [filename] ([num mappers])"
                _ -> do
                        let nMap = case length args of
                                1 -> 16
                                _ -> read $ args!!1
                        state <- getLines (head args)                                
                        let res = mapReduce nMap state
                        return res
        showNice out



-- put data
main::IO()
main = do
        args <- getArgs
        out <- case length args of 
                0 -> error "Usage: wordcount [filename] ([num mappers])"
                _ -> do
                        let nMap = case length args of
                                1 -> 16
                                _ -> read $ args!!1
                        state <- getLines (head args)                                
                        let res = mapReduce nMap state
                        return res
        showNice out



-- put data
main = do
        args <- getArgs
        out <- case length args of 
                0 -> error "Usage: wordcount [filename] ([num mappers])"
                _ -> do
                        let nMap = case length args of
                                1 -> 16
                                _ -> read $ args!!1
                        state <- getLines (head args)                                
                        let res = mapReduce nMap state
                        return res
        showNice out



-- put data