{"action":"created","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":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-11T00:08:16Z","updated_at":"2015-05-11T20:12:58Z","closed_at":null,"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"},"comment":{"url":"https://api.github.com/repos/Gabriel439/Haskell-Turtle-Library/issues/comments/101034745","html_url":"https://github.com/Gabriel439/Haskell-Turtle-Library/issues/50#issuecomment-101034745","issue_url":"https://api.github.com/repos/Gabriel439/Haskell-Turtle-Library/issues/50","id":101034745,"user":{"login":"Gabriel439","id":1313787,"avatar_url":"https://avatars.githubusercontent.com/u/1313787?v=3","gravatar_id":"","url":"https://api.github.com/users/Gabriel439","html_url":"https://github.com/Gabriel439","followers_url":"https://api.github.com/users/Gabriel439/followers","following_url":"https://api.github.com/users/Gabriel439/following{/other_user}","gists_url":"https://api.github.com/users/Gabriel439/gists{/gist_id}","starred_url":"https://api.github.com/users/Gabriel439/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gabriel439/subscriptions","organizations_url":"https://api.github.com/users/Gabriel439/orgs","repos_url":"https://api.github.com/users/Gabriel439/repos","events_url":"https://api.github.com/users/Gabriel439/events{/privacy}","received_events_url":"https://api.github.com/users/Gabriel439/received_events","type":"User","site_admin":false},"created_at":"2015-05-11T20:12:58Z","updated_at":"2015-05-11T20:12:58Z","body":"That's alright! :)\r\n\r\nFor future reference, you don't even need to install `git`!  Just navigate to the file you want to modify and click the pencil icon in the top-right corner of the file to edit it.  When you save the file contents it will fork the repository and create a new branch from your edits and then prompt you to create a pull request.  I use this trick all the time to submit tiny pull requests to other Haskell repositories (like bumping cabal version bounds and things like that).  Then you can rely on travis to compile and test your branch for you.  The whole process is pretty slick once you get used to it."}}