{"action":"created","issue":{"url":"https://api.github.com/repos/Soostone/katip/issues/18","repository_url":"https://api.github.com/repos/Soostone/katip","labels_url":"https://api.github.com/repos/Soostone/katip/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/Soostone/katip/issues/18/comments","events_url":"https://api.github.com/repos/Soostone/katip/issues/18/events","html_url":"https://github.com/Soostone/katip/pull/18","id":145529486,"number":18,"title":"Fixed #10: use implicit parameter callstacks","user":{"login":"adinapoli","id":442035,"avatar_url":"https://avatars.githubusercontent.com/u/442035?v=3","gravatar_id":"","url":"https://api.github.com/users/adinapoli","html_url":"https://github.com/adinapoli","followers_url":"https://api.github.com/users/adinapoli/followers","following_url":"https://api.github.com/users/adinapoli/following{/other_user}","gists_url":"https://api.github.com/users/adinapoli/gists{/gist_id}","starred_url":"https://api.github.com/users/adinapoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adinapoli/subscriptions","organizations_url":"https://api.github.com/users/adinapoli/orgs","repos_url":"https://api.github.com/users/adinapoli/repos","events_url":"https://api.github.com/users/adinapoli/events{/privacy}","received_events_url":"https://api.github.com/users/adinapoli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"MichaelXavier","id":15840,"avatar_url":"https://avatars.githubusercontent.com/u/15840?v=3","gravatar_id":"","url":"https://api.github.com/users/MichaelXavier","html_url":"https://github.com/MichaelXavier","followers_url":"https://api.github.com/users/MichaelXavier/followers","following_url":"https://api.github.com/users/MichaelXavier/following{/other_user}","gists_url":"https://api.github.com/users/MichaelXavier/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelXavier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelXavier/subscriptions","organizations_url":"https://api.github.com/users/MichaelXavier/orgs","repos_url":"https://api.github.com/users/MichaelXavier/repos","events_url":"https://api.github.com/users/MichaelXavier/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelXavier/received_events","type":"User","site_admin":false},"milestone":null,"comments":9,"created_at":"2016-04-03T18:58:24Z","updated_at":"2016-04-07T09:36:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Soostone/katip/pulls/18","html_url":"https://github.com/Soostone/katip/pull/18","diff_url":"https://github.com/Soostone/katip/pull/18.diff","patch_url":"https://github.com/Soostone/katip/pull/18.patch"},"body":"@MichaelXavier , @ozataman hey folks!\r\n\r\nI had 1 hour of spare hacking time, so I thought about contributing to Katip on a low-hanging fruit :wink: \r\n\r\nThis PR delivers a minimal rewrite of the `getLoc` function to remove the need for TH, using implicit-parameters and the `GHC.Stack` module to retrieve the callstack. The end result between the TH-driven and the srcLoc-driven output is the same (from `katip/examples/example.hs):\r\n\r\n<img width=\"1280\" alt=\"screen shot 2016-04-03 at 19 03 08\" src=\"https://cloud.githubusercontent.com/assets/442035/14234218/1e614066-f9d5-11e5-9569-8ccca79d3ecf.png\">\r\n\r\n\r\n<img width=\"1279\" alt=\"screen shot 2016-04-03 at 19 29 32\" src=\"https://cloud.githubusercontent.com/assets/442035/14234216/165e5d0e-f9d5-11e5-815c-f0735cc133f9.png\">\r\n\r\nWhat we gained is, of course, that there is no need anymore for calling `logT` and `logTM` with the TH splicing syntax, which makes the API a little nicer. \r\n\r\n#### The technical implementation\r\n\r\nI have adopted the path of least resistance, and `getLoc` simply converts a `SrcLoc` into a `Loc`. This is mostly to not break the existing API, but also because the current code assumes we can construct a `Loc` in the marshalling code, but [SrcLoc](https://hackage.haskell.org/package/base-4.8.2.0/docs/GHC-SrcLoc.html#t:SrcLoc) has no exposed constructor. That's why I ended up with the current implementation. To recap what this PR delivers:\r\n\r\n* A rewrite a `getLoc` using [GHC.Stack.Callstack](https://hackage.haskell.org/package/base-4.8.2.0/docs/GHC-Stack.html), reusing the existing code as much as possible.\r\n\r\n* Does **not** bump the package version, as usually this is done by package maintainers\r\n\r\n* Ported all the examples, docs and code to use the \"new\" syntax for `logT` and `logTM` (no need for TH)\r\n\r\n* Does **not** remove the `TH.Lift` instances we had in place originally. I haven't tried removing them, but I guess it does no harm in keeping them (aka I don't know if they were needed only for logT/logTM or also for other TH invokations)\r\n\r\n<hr/>\r\n\r\nLast but not least, if you think this is not the way to go or using the implicit-params callstack is not a good idea at all don't worry, I won't hold anything against you :wink: It was a fun exercise in an-otherwise-boring afternoon.\r\n\r\nAlfredo"},"comment":{"url":"https://api.github.com/repos/Soostone/katip/issues/comments/206784213","html_url":"https://github.com/Soostone/katip/pull/18#issuecomment-206784213","issue_url":"https://api.github.com/repos/Soostone/katip/issues/18","id":206784213,"user":{"login":"ibotty","id":296430,"avatar_url":"https://avatars.githubusercontent.com/u/296430?v=3","gravatar_id":"","url":"https://api.github.com/users/ibotty","html_url":"https://github.com/ibotty","followers_url":"https://api.github.com/users/ibotty/followers","following_url":"https://api.github.com/users/ibotty/following{/other_user}","gists_url":"https://api.github.com/users/ibotty/gists{/gist_id}","starred_url":"https://api.github.com/users/ibotty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibotty/subscriptions","organizations_url":"https://api.github.com/users/ibotty/orgs","repos_url":"https://api.github.com/users/ibotty/repos","events_url":"https://api.github.com/users/ibotty/events{/privacy}","received_events_url":"https://api.github.com/users/ibotty/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T09:36:22Z","updated_at":"2016-04-07T09:36:22Z","body":"I am in agreement but for one little point.\r\n\r\nWhy wait for the non-TH api? Add it now, using source locations when available, or without when not. That way, deprecation is not even necessary. People that are on new-enough ghc (or don't care for source location) can just use the non-TH api right away; people that are on older ghc, can use the TH api. No need to deprecate anything.\r\n\r\nOf course that makes it one of the three hard problems of computer-science."}}