{"action":"opened","issue":{"url":"https://api.github.com/repos/milessabin/shapeless/issues/796","repository_url":"https://api.github.com/repos/milessabin/shapeless","labels_url":"https://api.github.com/repos/milessabin/shapeless/issues/796/labels{/name}","comments_url":"https://api.github.com/repos/milessabin/shapeless/issues/796/comments","events_url":"https://api.github.com/repos/milessabin/shapeless/issues/796/events","html_url":"https://github.com/milessabin/shapeless/issues/796","id":283641731,"number":796,"title":"Forcing instance from companion object","user":{"login":"gaydenko","id":3740016,"avatar_url":"https://avatars2.githubusercontent.com/u/3740016?v=4","gravatar_id":"","url":"https://api.github.com/users/gaydenko","html_url":"https://github.com/gaydenko","followers_url":"https://api.github.com/users/gaydenko/followers","following_url":"https://api.github.com/users/gaydenko/following{/other_user}","gists_url":"https://api.github.com/users/gaydenko/gists{/gist_id}","starred_url":"https://api.github.com/users/gaydenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaydenko/subscriptions","organizations_url":"https://api.github.com/users/gaydenko/orgs","repos_url":"https://api.github.com/users/gaydenko/repos","events_url":"https://api.github.com/users/gaydenko/events{/privacy}","received_events_url":"https://api.github.com/users/gaydenko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-20T17:37:46Z","updated_at":"2017-12-20T17:37:46Z","closed_at":null,"author_association":"NONE","body":"Hi! \r\n\r\nI'd want to bring you attention to ambiguity I have met recently.\r\nHere https://scastie.scala-lang.org/gaydenko/Erq9WXYiROq689JuQZBVjg short\r\ntest case takes place, and almost code is just a `CsvEncoder` from\r\nthe shapeless guide. The test case output is:\r\n```\r\nList(with data)\r\nList(Something special)\r\n```\r\nYou see, we just get `Data` having special `CsvEncoder` instance and two\r\ncase classes using this `Data`. The only difference is for the second\r\none (`WithData2`) we import `Data.encoder` just before summoning\r\n`WithData2.encoder`.\r\n\r\nAs a result, at the first case we get shapeless-generated\r\n`CsvEncoder` instance for `Data`, and at the second case we get\r\nspecialized `CsvEncoder` for `Data`.\r\n\r\nSo, the question is: what is that robust way to use specialized\r\nencoder (would it exists in the companion object) at any case, that\r\nis without remembering to bring `Data.encoder` to nearest scope\r\n```\r\n  implicit val dataEncoder = Data.encoder\r\n  implicit val encoder: CsvEncoder[WithData2] = cachedImplicit\r\n```\r\n? I mean `CsvEncoder` code modification and keeping `Data`-using\r\ncode intact."}}
{"actor":{"display_login":"gaydenko"}}