{"action":"created","comment":{"url":"https://api.github.com/repos/flycheck/flycheck/pulls/comments/70215031","id":70215031,"diff_hunk":"@@ -6976,6 +6976,45 @@ Otherwise return the previously used cache directory.\"\n         (or flycheck-haskell-ghc-cache-directory\n             (make-temp-file \"flycheck-haskell-ghc-cache\" 'directory))))\n \n+(defun flycheck-haskell--find-default-directory (checker)\n+  \"Come up with a sutable default directory for Haskell to run\n+checker in.\n+\n+In case of `haskell-stack-ghc' checker it is directory with\n+stack.yaml file. If there's no stack.yaml file in any parent\n+directory, it will be the directory that \\\"stack path --project-root\\\"\n+command returs.\n+\n+For all other checkers, it is the closest parent directory that\n+contains cabal file.\"\n+  (pcase checker\n+    (`haskell-stack-ghc\n+     (or\n+      (locate-dominating-file (buffer-file-name) \"stack.yaml\")\n+      (when (executable-find \"stack\")\n+        (let* ((stack-output\n+                (process-lines \"stack\" \"path\" \"--project-root\"))\n+               (stack-dir\n+                (when stack-output\n+                  (car stack-output))))\n+          (when (and stack-dir\n+                     (file-directory-p stack-dir))\n+            stack-dir)))))\n+    (_\n+     (if (fboundp 'haskell-cabal-find-file)\n+         (let ((cabal-file (haskell-cabal-find-file)))\n+           (when cabal-file\n+             (file-name-directory cabal-file)))\n+       (locate-dominating-file (file-name-directory (buffer-file-name))\n+                               (lambda (dir)\n+                                 (not\n+                                  (null\n+                                   (directory-files dir","path":"flycheck.el","position":37,"original_position":37,"commit_id":"2ff2fc17cfd1fd991293b7bf3e8f22f05aadc231","original_commit_id":"2ff2fc17cfd1fd991293b7bf3e8f22f05aadc231","user":{"login":"lunaryorn","id":224922,"avatar_url":"https://avatars.githubusercontent.com/u/224922?v=3","gravatar_id":"","url":"https://api.github.com/users/lunaryorn","html_url":"https://github.com/lunaryorn","followers_url":"https://api.github.com/users/lunaryorn/followers","following_url":"https://api.github.com/users/lunaryorn/following{/other_user}","gists_url":"https://api.github.com/users/lunaryorn/gists{/gist_id}","starred_url":"https://api.github.com/users/lunaryorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lunaryorn/subscriptions","organizations_url":"https://api.github.com/users/lunaryorn/orgs","repos_url":"https://api.github.com/users/lunaryorn/repos","events_url":"https://api.github.com/users/lunaryorn/events{/privacy}","received_events_url":"https://api.github.com/users/lunaryorn/received_events","type":"User","site_admin":false},"body":"@sergv It's fine to just return the list in this case.  The double negation doesn't really add anything imho.","created_at":"2016-07-11T07:56:23Z","updated_at":"2016-07-11T07:56:23Z","html_url":"https://github.com/flycheck/flycheck/pull/1007#discussion_r70215031","pull_request_url":"https://api.github.com/repos/flycheck/flycheck/pulls/1007","_links":{"self":{"href":"https://api.github.com/repos/flycheck/flycheck/pulls/comments/70215031"},"html":{"href":"https://github.com/flycheck/flycheck/pull/1007#discussion_r70215031"},"pull_request":{"href":"https://api.github.com/repos/flycheck/flycheck/pulls/1007"}}},"pull_request":{"url":"https://api.github.com/repos/flycheck/flycheck/pulls/1007","id":76859543,"html_url":"https://github.com/flycheck/flycheck/pull/1007","diff_url":"https://github.com/flycheck/flycheck/pull/1007.diff","patch_url":"https://github.com/flycheck/flycheck/pull/1007.patch","issue_url":"https://api.github.com/repos/flycheck/flycheck/issues/1007","number":1007,"state":"open","locked":false,"title":"Define default directory for haskell-stack-ghc checker","user":{"login":"sergv","id":1149355,"avatar_url":"https://avatars.githubusercontent.com/u/1149355?v=3","gravatar_id":"","url":"https://api.github.com/users/sergv","html_url":"https://github.com/sergv","followers_url":"https://api.github.com/users/sergv/followers","following_url":"https://api.github.com/users/sergv/following{/other_user}","gists_url":"https://api.github.com/users/sergv/gists{/gist_id}","starred_url":"https://api.github.com/users/sergv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergv/subscriptions","organizations_url":"https://api.github.com/users/sergv/orgs","repos_url":"https://api.github.com/users/sergv/repos","events_url":"https://api.github.com/users/sergv/events{/privacy}","received_events_url":"https://api.github.com/users/sergv/received_events","type":"User","site_admin":false},"body":"Default directory is detected either by looking for `stack.yaml` or asking `stack path --project-root` for `haskel-stack-ghc` checker or by looking for cabal file in case of `haskell-ghc` checker.\r\n\r\n@mrkkrp Please comment, if you think something should be done differently.","created_at":"2016-07-09T23:12:47Z","updated_at":"2016-07-11T07:56:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5f1fedd9116ae6df28765259e3cf5cb27e928eb2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/flycheck/flycheck/pulls/1007/commits","review_comments_url":"https://api.github.com/repos/flycheck/flycheck/pulls/1007/comments","review_comment_url":"https://api.github.com/repos/flycheck/flycheck/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flycheck/flycheck/issues/1007/comments","statuses_url":"https://api.github.com/repos/flycheck/flycheck/statuses/2ff2fc17cfd1fd991293b7bf3e8f22f05aadc231","head":{"label":"sergv:stack-ghc-checker-default-directory","ref":"stack-ghc-checker-default-directory","sha":"2ff2fc17cfd1fd991293b7bf3e8f22f05aadc231","user":{"login":"sergv","id":1149355,"avatar_url":"https://avatars.githubusercontent.com/u/1149355?v=3","gravatar_id":"","url":"https://api.github.com/users/sergv","html_url":"https://github.com/sergv","followers_url":"https://api.github.com/users/sergv/followers","following_url":"https://api.github.com/users/sergv/following{/other_user}","gists_url":"https://api.github.com/users/sergv/gists{/gist_id}","starred_url":"https://api.github.com/users/sergv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergv/subscriptions","organizations_url":"https://api.github.com/users/sergv/orgs","repos_url":"https://api.github.com/users/sergv/repos","events_url":"https://api.github.com/users/sergv/events{/privacy}","received_events_url":"https://api.github.com/users/sergv/received_events","type":"User","site_admin":false},"repo":{"id":58913855,"name":"flycheck","full_name":"sergv/flycheck","owner":{"login":"sergv","id":1149355,"avatar_url":"https://avatars.githubusercontent.com/u/1149355?v=3","gravatar_id":"","url":"https://api.github.com/users/sergv","html_url":"https://github.com/sergv","followers_url":"https://api.github.com/users/sergv/followers","following_url":"https://api.github.com/users/sergv/following{/other_user}","gists_url":"https://api.github.com/users/sergv/gists{/gist_id}","starred_url":"https://api.github.com/users/sergv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergv/subscriptions","organizations_url":"https://api.github.com/users/sergv/orgs","repos_url":"https://api.github.com/users/sergv/repos","events_url":"https://api.github.com/users/sergv/events{/privacy}","received_events_url":"https://api.github.com/users/sergv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sergv/flycheck","description":"Modern on the fly syntax checking for GNU Emacs","fork":true,"url":"https://api.github.com/repos/sergv/flycheck","forks_url":"https://api.github.com/repos/sergv/flycheck/forks","keys_url":"https://api.github.com/repos/sergv/flycheck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sergv/flycheck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sergv/flycheck/teams","hooks_url":"https://api.github.com/repos/sergv/flycheck/hooks","issue_events_url":"https://api.github.com/repos/sergv/flycheck/issues/events{/number}","events_url":"https://api.github.com/repos/sergv/flycheck/events","assignees_url":"https://api.github.com/repos/sergv/flycheck/assignees{/user}","branches_url":"https://api.github.com/repos/sergv/flycheck/branches{/branch}","tags_url":"https://api.github.com/repos/sergv/flycheck/tags","blobs_url":"https://api.github.com/repos/sergv/flycheck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sergv/flycheck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sergv/flycheck/git/refs{/sha}","trees_url":"https://api.github.com/repos/sergv/flycheck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sergv/flycheck/statuses/{sha}","languages_url":"https://api.github.com/repos/sergv/flycheck/languages","stargazers_url":"https://api.github.com/repos/sergv/flycheck/stargazers","contributors_url":"https://api.github.com/repos/sergv/flycheck/contributors","subscribers_url":"https://api.github.com/repos/sergv/flycheck/subscribers","subscription_url":"https://api.github.com/repos/sergv/flycheck/subscription","commits_url":"https://api.github.com/repos/sergv/flycheck/commits{/sha}","git_commits_url":"https://api.github.com/repos/sergv/flycheck/git/commits{/sha}","comments_url":"https://api.github.com/repos/sergv/flycheck/comments{/number}","issue_comment_url":"https://api.github.com/repos/sergv/flycheck/issues/comments{/number}","contents_url":"https://api.github.com/repos/sergv/flycheck/contents/{+path}","compare_url":"https://api.github.com/repos/sergv/flycheck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sergv/flycheck/merges","archive_url":"https://api.github.com/repos/sergv/flycheck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sergv/flycheck/downloads","issues_url":"https://api.github.com/repos/sergv/flycheck/issues{/number}","pulls_url":"https://api.github.com/repos/sergv/flycheck/pulls{/number}","milestones_url":"https://api.github.com/repos/sergv/flycheck/milestones{/number}","notifications_url":"https://api.github.com/repos/sergv/flycheck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sergv/flycheck/labels{/name}","releases_url":"https://api.github.com/repos/sergv/flycheck/releases{/id}","deployments_url":"https://api.github.com/repos/sergv/flycheck/deployments","created_at":"2016-05-16T07:52:27Z","updated_at":"2016-05-16T07:52:28Z","pushed_at":"2016-07-10T09:56:38Z","git_url":"git://github.com/sergv/flycheck.git","ssh_url":"git@github.com:sergv/flycheck.git","clone_url":"https://github.com/sergv/flycheck.git","svn_url":"https://github.com/sergv/flycheck","homepage":"http://www.flycheck.org","size":15091,"stargazers_count":0,"watchers_count":0,"language":"Emacs Lisp","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"flycheck:master","ref":"master","sha":"99a22015abf19acef517268989fb2bfd45598f2b","user":{"login":"flycheck","id":5254142,"avatar_url":"https://avatars.githubusercontent.com/u/5254142?v=3","gravatar_id":"","url":"https://api.github.com/users/flycheck","html_url":"https://github.com/flycheck","followers_url":"https://api.github.com/users/flycheck/followers","following_url":"https://api.github.com/users/flycheck/following{/other_user}","gists_url":"https://api.github.com/users/flycheck/gists{/gist_id}","starred_url":"https://api.github.com/users/flycheck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flycheck/subscriptions","organizations_url":"https://api.github.com/users/flycheck/orgs","repos_url":"https://api.github.com/users/flycheck/repos","events_url":"https://api.github.com/users/flycheck/events{/privacy}","received_events_url":"https://api.github.com/users/flycheck/received_events","type":"Organization","site_admin":false},"repo":{"id":6158882,"name":"flycheck","full_name":"flycheck/flycheck","owner":{"login":"flycheck","id":5254142,"avatar_url":"https://avatars.githubusercontent.com/u/5254142?v=3","gravatar_id":"","url":"https://api.github.com/users/flycheck","html_url":"https://github.com/flycheck","followers_url":"https://api.github.com/users/flycheck/followers","following_url":"https://api.github.com/users/flycheck/following{/other_user}","gists_url":"https://api.github.com/users/flycheck/gists{/gist_id}","starred_url":"https://api.github.com/users/flycheck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flycheck/subscriptions","organizations_url":"https://api.github.com/users/flycheck/orgs","repos_url":"https://api.github.com/users/flycheck/repos","events_url":"https://api.github.com/users/flycheck/events{/privacy}","received_events_url":"https://api.github.com/users/flycheck/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flycheck/flycheck","description":"On the fly syntax checking for GNU Emacs","fork":false,"url":"https://api.github.com/repos/flycheck/flycheck","forks_url":"https://api.github.com/repos/flycheck/flycheck/forks","keys_url":"https://api.github.com/repos/flycheck/flycheck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flycheck/flycheck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flycheck/flycheck/teams","hooks_url":"https://api.github.com/repos/flycheck/flycheck/hooks","issue_events_url":"https://api.github.com/repos/flycheck/flycheck/issues/events{/number}","events_url":"https://api.github.com/repos/flycheck/flycheck/events","assignees_url":"https://api.github.com/repos/flycheck/flycheck/assignees{/user}","branches_url":"https://api.github.com/repos/flycheck/flycheck/branches{/branch}","tags_url":"https://api.github.com/repos/flycheck/flycheck/tags","blobs_url":"https://api.github.com/repos/flycheck/flycheck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flycheck/flycheck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flycheck/flycheck/git/refs{/sha}","trees_url":"https://api.github.com/repos/flycheck/flycheck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flycheck/flycheck/statuses/{sha}","languages_url":"https://api.github.com/repos/flycheck/flycheck/languages","stargazers_url":"https://api.github.com/repos/flycheck/flycheck/stargazers","contributors_url":"https://api.github.com/repos/flycheck/flycheck/contributors","subscribers_url":"https://api.github.com/repos/flycheck/flycheck/subscribers","subscription_url":"https://api.github.com/repos/flycheck/flycheck/subscription","commits_url":"https://api.github.com/repos/flycheck/flycheck/commits{/sha}","git_commits_url":"https://api.github.com/repos/flycheck/flycheck/git/commits{/sha}","comments_url":"https://api.github.com/repos/flycheck/flycheck/comments{/number}","issue_comment_url":"https://api.github.com/repos/flycheck/flycheck/issues/comments{/number}","contents_url":"https://api.github.com/repos/flycheck/flycheck/contents/{+path}","compare_url":"https://api.github.com/repos/flycheck/flycheck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flycheck/flycheck/merges","archive_url":"https://api.github.com/repos/flycheck/flycheck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flycheck/flycheck/downloads","issues_url":"https://api.github.com/repos/flycheck/flycheck/issues{/number}","pulls_url":"https://api.github.com/repos/flycheck/flycheck/pulls{/number}","milestones_url":"https://api.github.com/repos/flycheck/flycheck/milestones{/number}","notifications_url":"https://api.github.com/repos/flycheck/flycheck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flycheck/flycheck/labels{/name}","releases_url":"https://api.github.com/repos/flycheck/flycheck/releases{/id}","deployments_url":"https://api.github.com/repos/flycheck/flycheck/deployments","created_at":"2012-10-10T14:45:13Z","updated_at":"2016-07-11T05:26:04Z","pushed_at":"2016-07-10T09:56:39Z","git_url":"git://github.com/flycheck/flycheck.git","ssh_url":"git@github.com:flycheck/flycheck.git","clone_url":"https://github.com/flycheck/flycheck.git","svn_url":"https://github.com/flycheck/flycheck","homepage":"http://www.flycheck.org","size":18030,"stargazers_count":1066,"watchers_count":1066,"language":"Emacs Lisp","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":214,"mirror_url":null,"open_issues_count":60,"forks":214,"open_issues":60,"watchers":1066,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flycheck/flycheck/pulls/1007"},"html":{"href":"https://github.com/flycheck/flycheck/pull/1007"},"issue":{"href":"https://api.github.com/repos/flycheck/flycheck/issues/1007"},"comments":{"href":"https://api.github.com/repos/flycheck/flycheck/issues/1007/comments"},"review_comments":{"href":"https://api.github.com/repos/flycheck/flycheck/pulls/1007/comments"},"review_comment":{"href":"https://api.github.com/repos/flycheck/flycheck/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flycheck/flycheck/pulls/1007/commits"},"statuses":{"href":"https://api.github.com/repos/flycheck/flycheck/statuses/2ff2fc17cfd1fd991293b7bf3e8f22f05aadc231"}}}}
{"actor":{"display_login":"lunaryorn"}}