{"action":"created","comment":{"url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/comments/33735119","id":33735119,"diff_hunk":"@@ -0,0 +1,67 @@\n+module Language.Haskell.GhcMod.FileMapping\n+    ( loadMappedFile\n+    , loadMappedFiles\n+    , unloadMappedFile\n+    , mapFile\n+    ) where\n+\n+import Language.Haskell.GhcMod.Types\n+import Language.Haskell.GhcMod.Monad.Types\n+import Language.Haskell.GhcMod.Gap\n+import Language.Haskell.GhcMod.HomeModuleGraph\n+\n+import System.Directory\n+import System.FilePath\n+\n+import Data.Time\n+\n+import Control.Monad.Trans.Maybe\n+import GHC\n+\n+loadMappedFiles :: IOish m => GhcModT m ()\n+loadMappedFiles = do\n+  Options {fileMappings} <- options\n+  mapM_ (uncurry loadMappedFile) $ reverse fileMappings\n+\n+loadMappedFile :: IOish m => FilePath -> FileMapping -> GhcModT m ()\n+loadMappedFile from fm@(RedirectedMapping _) =\n+  addToState from fm\n+loadMappedFile from (MemoryMapping _) = do\n+  let loop' acc = do\n+        line <- getLine","path":"Language/Haskell/GhcMod/FileMapping.hs","position":31,"original_position":31,"commit_id":"a40a4508b1aeab439b6be48e78987b03b65039cc","original_commit_id":"a40a4508b1aeab439b6be48e78987b03b65039cc","user":{"login":"DanielG","id":199218,"avatar_url":"https://avatars.githubusercontent.com/u/199218?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielG","html_url":"https://github.com/DanielG","followers_url":"https://api.github.com/users/DanielG/followers","following_url":"https://api.github.com/users/DanielG/following{/other_user}","gists_url":"https://api.github.com/users/DanielG/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielG/subscriptions","organizations_url":"https://api.github.com/users/DanielG/orgs","repos_url":"https://api.github.com/users/DanielG/repos","events_url":"https://api.github.com/users/DanielG/events{/privacy}","received_events_url":"https://api.github.com/users/DanielG/received_events","type":"User","site_admin":false},"body":"This seems the wrong place to do that piece of IO. Should really be in the frontend code.","created_at":"2015-07-01T23:19:02Z","updated_at":"2015-07-01T23:19:02Z","html_url":"https://github.com/kazu-yamamoto/ghc-mod/pull/484#discussion_r33735119","pull_request_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/484","_links":{"self":{"href":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/comments/33735119"},"html":{"href":"https://github.com/kazu-yamamoto/ghc-mod/pull/484#discussion_r33735119"},"pull_request":{"href":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/484"}}},"pull_request":{"url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/484","id":36580595,"html_url":"https://github.com/kazu-yamamoto/ghc-mod/pull/484","diff_url":"https://github.com/kazu-yamamoto/ghc-mod/pull/484.diff","patch_url":"https://github.com/kazu-yamamoto/ghc-mod/pull/484.patch","issue_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/issues/484","number":484,"state":"open","locked":false,"title":"File redirection","user":{"login":"lierdakil","id":7275622,"avatar_url":"https://avatars.githubusercontent.com/u/7275622?v=3","gravatar_id":"","url":"https://api.github.com/users/lierdakil","html_url":"https://github.com/lierdakil","followers_url":"https://api.github.com/users/lierdakil/followers","following_url":"https://api.github.com/users/lierdakil/following{/other_user}","gists_url":"https://api.github.com/users/lierdakil/gists{/gist_id}","starred_url":"https://api.github.com/users/lierdakil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lierdakil/subscriptions","organizations_url":"https://api.github.com/users/lierdakil/orgs","repos_url":"https://api.github.com/users/lierdakil/repos","events_url":"https://api.github.com/users/lierdakil/events{/privacy}","received_events_url":"https://api.github.com/users/lierdakil/received_events","type":"User","site_admin":false},"body":"## THIS IS WIP, DON'T MERGE\r\n\r\nAs discussed in #482, I started working on this. Initial results show promise.\r\n\r\nI want to run this through Travis to see if I broke anything.\r\n\r\nThis is a working prototype, but code style is rather horrible (sleep deprivation does that)\r\n\r\nI would be very grateful if someone reviews my efforts thus far.\r\n\r\nTODO:\r\n- [x] Cleanup\r\n- [x] Load all mapped files as targets\r\n- [x] Replace mapped names with original ones in output\r\n- [ ] Verification\r\n- [ ] Tests\r\n- [ ] Squash?","created_at":"2015-05-31T11:11:30Z","updated_at":"2015-07-01T23:19:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2936417693c9c40f2c485c5ae4c93c5d0506184","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/484/commits","review_comments_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/484/comments","review_comment_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/issues/484/comments","statuses_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/statuses/a40a4508b1aeab439b6be48e78987b03b65039cc","head":{"label":"atom-haskell:file-redirection","ref":"file-redirection","sha":"a40a4508b1aeab439b6be48e78987b03b65039cc","user":{"login":"atom-haskell","id":12533767,"avatar_url":"https://avatars.githubusercontent.com/u/12533767?v=3","gravatar_id":"","url":"https://api.github.com/users/atom-haskell","html_url":"https://github.com/atom-haskell","followers_url":"https://api.github.com/users/atom-haskell/followers","following_url":"https://api.github.com/users/atom-haskell/following{/other_user}","gists_url":"https://api.github.com/users/atom-haskell/gists{/gist_id}","starred_url":"https://api.github.com/users/atom-haskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom-haskell/subscriptions","organizations_url":"https://api.github.com/users/atom-haskell/orgs","repos_url":"https://api.github.com/users/atom-haskell/repos","events_url":"https://api.github.com/users/atom-haskell/events{/privacy}","received_events_url":"https://api.github.com/users/atom-haskell/received_events","type":"Organization","site_admin":false},"repo":{"id":36581508,"name":"ghc-mod","full_name":"atom-haskell/ghc-mod","owner":{"login":"atom-haskell","id":12533767,"avatar_url":"https://avatars.githubusercontent.com/u/12533767?v=3","gravatar_id":"","url":"https://api.github.com/users/atom-haskell","html_url":"https://github.com/atom-haskell","followers_url":"https://api.github.com/users/atom-haskell/followers","following_url":"https://api.github.com/users/atom-haskell/following{/other_user}","gists_url":"https://api.github.com/users/atom-haskell/gists{/gist_id}","starred_url":"https://api.github.com/users/atom-haskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom-haskell/subscriptions","organizations_url":"https://api.github.com/users/atom-haskell/orgs","repos_url":"https://api.github.com/users/atom-haskell/repos","events_url":"https://api.github.com/users/atom-haskell/events{/privacy}","received_events_url":"https://api.github.com/users/atom-haskell/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atom-haskell/ghc-mod","description":"Happy Haskell programming for editors","fork":true,"url":"https://api.github.com/repos/atom-haskell/ghc-mod","forks_url":"https://api.github.com/repos/atom-haskell/ghc-mod/forks","keys_url":"https://api.github.com/repos/atom-haskell/ghc-mod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atom-haskell/ghc-mod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atom-haskell/ghc-mod/teams","hooks_url":"https://api.github.com/repos/atom-haskell/ghc-mod/hooks","issue_events_url":"https://api.github.com/repos/atom-haskell/ghc-mod/issues/events{/number}","events_url":"https://api.github.com/repos/atom-haskell/ghc-mod/events","assignees_url":"https://api.github.com/repos/atom-haskell/ghc-mod/assignees{/user}","branches_url":"https://api.github.com/repos/atom-haskell/ghc-mod/branches{/branch}","tags_url":"https://api.github.com/repos/atom-haskell/ghc-mod/tags","blobs_url":"https://api.github.com/repos/atom-haskell/ghc-mod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atom-haskell/ghc-mod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atom-haskell/ghc-mod/git/refs{/sha}","trees_url":"https://api.github.com/repos/atom-haskell/ghc-mod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atom-haskell/ghc-mod/statuses/{sha}","languages_url":"https://api.github.com/repos/atom-haskell/ghc-mod/languages","stargazers_url":"https://api.github.com/repos/atom-haskell/ghc-mod/stargazers","contributors_url":"https://api.github.com/repos/atom-haskell/ghc-mod/contributors","subscribers_url":"https://api.github.com/repos/atom-haskell/ghc-mod/subscribers","subscription_url":"https://api.github.com/repos/atom-haskell/ghc-mod/subscription","commits_url":"https://api.github.com/repos/atom-haskell/ghc-mod/commits{/sha}","git_commits_url":"https://api.github.com/repos/atom-haskell/ghc-mod/git/commits{/sha}","comments_url":"https://api.github.com/repos/atom-haskell/ghc-mod/comments{/number}","issue_comment_url":"https://api.github.com/repos/atom-haskell/ghc-mod/issues/comments{/number}","contents_url":"https://api.github.com/repos/atom-haskell/ghc-mod/contents/{+path}","compare_url":"https://api.github.com/repos/atom-haskell/ghc-mod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atom-haskell/ghc-mod/merges","archive_url":"https://api.github.com/repos/atom-haskell/ghc-mod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atom-haskell/ghc-mod/downloads","issues_url":"https://api.github.com/repos/atom-haskell/ghc-mod/issues{/number}","pulls_url":"https://api.github.com/repos/atom-haskell/ghc-mod/pulls{/number}","milestones_url":"https://api.github.com/repos/atom-haskell/ghc-mod/milestones{/number}","notifications_url":"https://api.github.com/repos/atom-haskell/ghc-mod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atom-haskell/ghc-mod/labels{/name}","releases_url":"https://api.github.com/repos/atom-haskell/ghc-mod/releases{/id}","created_at":"2015-05-31T00:35:58Z","updated_at":"2015-06-04T04:46:29Z","pushed_at":"2015-06-16T10:50:01Z","git_url":"git://github.com/atom-haskell/ghc-mod.git","ssh_url":"git@github.com:atom-haskell/ghc-mod.git","clone_url":"https://github.com/atom-haskell/ghc-mod.git","svn_url":"https://github.com/atom-haskell/ghc-mod","homepage":"http://www.mew.org/~kazu/proj/ghc-mod/","size":1963,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"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":"kazu-yamamoto:master","ref":"master","sha":"1e381a12a9532eb9d7f38051674d210af7ce1ab7","user":{"login":"kazu-yamamoto","id":165387,"avatar_url":"https://avatars.githubusercontent.com/u/165387?v=3","gravatar_id":"","url":"https://api.github.com/users/kazu-yamamoto","html_url":"https://github.com/kazu-yamamoto","followers_url":"https://api.github.com/users/kazu-yamamoto/followers","following_url":"https://api.github.com/users/kazu-yamamoto/following{/other_user}","gists_url":"https://api.github.com/users/kazu-yamamoto/gists{/gist_id}","starred_url":"https://api.github.com/users/kazu-yamamoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kazu-yamamoto/subscriptions","organizations_url":"https://api.github.com/users/kazu-yamamoto/orgs","repos_url":"https://api.github.com/users/kazu-yamamoto/repos","events_url":"https://api.github.com/users/kazu-yamamoto/events{/privacy}","received_events_url":"https://api.github.com/users/kazu-yamamoto/received_events","type":"User","site_admin":false},"repo":{"id":555313,"name":"ghc-mod","full_name":"kazu-yamamoto/ghc-mod","owner":{"login":"kazu-yamamoto","id":165387,"avatar_url":"https://avatars.githubusercontent.com/u/165387?v=3","gravatar_id":"","url":"https://api.github.com/users/kazu-yamamoto","html_url":"https://github.com/kazu-yamamoto","followers_url":"https://api.github.com/users/kazu-yamamoto/followers","following_url":"https://api.github.com/users/kazu-yamamoto/following{/other_user}","gists_url":"https://api.github.com/users/kazu-yamamoto/gists{/gist_id}","starred_url":"https://api.github.com/users/kazu-yamamoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kazu-yamamoto/subscriptions","organizations_url":"https://api.github.com/users/kazu-yamamoto/orgs","repos_url":"https://api.github.com/users/kazu-yamamoto/repos","events_url":"https://api.github.com/users/kazu-yamamoto/events{/privacy}","received_events_url":"https://api.github.com/users/kazu-yamamoto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kazu-yamamoto/ghc-mod","description":"Happy Haskell programming for editors","fork":false,"url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod","forks_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/forks","keys_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/teams","hooks_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/hooks","issue_events_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/issues/events{/number}","events_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/events","assignees_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/assignees{/user}","branches_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/branches{/branch}","tags_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/tags","blobs_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/git/refs{/sha}","trees_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/statuses/{sha}","languages_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/languages","stargazers_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/stargazers","contributors_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/contributors","subscribers_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/subscribers","subscription_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/subscription","commits_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/commits{/sha}","git_commits_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/git/commits{/sha}","comments_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/comments{/number}","issue_comment_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/issues/comments{/number}","contents_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/contents/{+path}","compare_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/merges","archive_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/downloads","issues_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/issues{/number}","pulls_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls{/number}","milestones_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/milestones{/number}","notifications_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/labels{/name}","releases_url":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/releases{/id}","created_at":"2010-03-10T03:02:30Z","updated_at":"2015-06-28T19:29:20Z","pushed_at":"2015-06-16T10:50:02Z","git_url":"git://github.com/kazu-yamamoto/ghc-mod.git","ssh_url":"git@github.com:kazu-yamamoto/ghc-mod.git","clone_url":"https://github.com/kazu-yamamoto/ghc-mod.git","svn_url":"https://github.com/kazu-yamamoto/ghc-mod","homepage":"http://www.mew.org/~kazu/proj/ghc-mod/","size":4785,"stargazers_count":363,"watchers_count":363,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":109,"mirror_url":null,"open_issues_count":69,"forks":109,"open_issues":69,"watchers":363,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/484"},"html":{"href":"https://github.com/kazu-yamamoto/ghc-mod/pull/484"},"issue":{"href":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/issues/484"},"comments":{"href":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/issues/484/comments"},"review_comments":{"href":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/484/comments"},"review_comment":{"href":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/pulls/484/commits"},"statuses":{"href":"https://api.github.com/repos/kazu-yamamoto/ghc-mod/statuses/a40a4508b1aeab439b6be48e78987b03b65039cc"}}}}