{"action":"closed","issue":{"url":"https://api.github.com/repos/Gabriel439/Haskell-Turtle-Library/issues/50","labels_url":"https://api.github.com/repos/Gabriel439/Haskell-Turtle-Library/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/Gabriel439/Haskell-Turtle-Library/issues/50/comments","events_url":"https://api.github.com/repos/Gabriel439/Haskell-Turtle-Library/issues/50/events","html_url":"https://github.com/Gabriel439/Haskell-Turtle-Library/issues/50","id":75031731,"number":50,"title":"How about a simple getArgs?","user":{"login":"dalejordan","id":2274298,"avatar_url":"https://avatars.githubusercontent.com/u/2274298?v=3","gravatar_id":"","url":"https://api.github.com/users/dalejordan","html_url":"https://github.com/dalejordan","followers_url":"https://api.github.com/users/dalejordan/followers","following_url":"https://api.github.com/users/dalejordan/following{/other_user}","gists_url":"https://api.github.com/users/dalejordan/gists{/gist_id}","starred_url":"https://api.github.com/users/dalejordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalejordan/subscriptions","organizations_url":"https://api.github.com/users/dalejordan/orgs","repos_url":"https://api.github.com/users/dalejordan/repos","events_url":"https://api.github.com/users/dalejordan/events{/privacy}","received_events_url":"https://api.github.com/users/dalejordan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-11T00:08:16Z","updated_at":"2015-05-11T20:24:48Z","closed_at":"2015-05-11T20:24:48Z","body":"I wrote the following script as a Turtle learning exercise and was pleased with how it turned out (after a lot of backing and filling over discovering Turtle features and figuring out what else had to be imported).  Supporting\r\nOptparse-Applicative is a wonderful goal, but a simple addition of getArgs :: IO [Text] would go a long way towards cleaning up simple scripts.\r\n\r\n    #! /usr/bin/env runghc\r\n\r\n    {-# LANGUAGE OverloadedStrings #-}\r\n\r\n    import qualified Data.Text as T\r\n    import System.Environment (getArgs)\r\n    import Turtle\r\n\r\n    -- Search for haskell files using a given symbol a la unix grep.\r\n\r\n    main = do\r\n      [symS] <- getArgs\r\n      let sym = T.pack symS\r\n      dir <- fmap (</> \"hs\") home\r\n      sh (do file <- find (suffix \".hs\") dir\r\n             let fn = dirname file </> basename file\r\n             m <- grep (has (text sym)) (input file)\r\n             liftIO . echo $ format (fp % \": \" % s) fn m\r\n         )\r\n"}}