{"action":"opened","issue":{"url":"https://api.github.com/repos/Chymyst/curryhoward/issues/20","repository_url":"https://api.github.com/repos/Chymyst/curryhoward","labels_url":"https://api.github.com/repos/Chymyst/curryhoward/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/Chymyst/curryhoward/issues/20/comments","events_url":"https://api.github.com/repos/Chymyst/curryhoward/issues/20/events","html_url":"https://github.com/Chymyst/curryhoward/issues/20","id":294598607,"number":20,"title":"Generate identity functions for Unit values","user":{"login":"winitzki","id":2163489,"avatar_url":"https://avatars2.githubusercontent.com/u/2163489?v=4","gravatar_id":"","url":"https://api.github.com/users/winitzki","html_url":"https://github.com/winitzki","followers_url":"https://api.github.com/users/winitzki/followers","following_url":"https://api.github.com/users/winitzki/following{/other_user}","gists_url":"https://api.github.com/users/winitzki/gists{/gist_id}","starred_url":"https://api.github.com/users/winitzki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winitzki/subscriptions","organizations_url":"https://api.github.com/users/winitzki/orgs","repos_url":"https://api.github.com/users/winitzki/repos","events_url":"https://api.github.com/users/winitzki/events{/privacy}","received_events_url":"https://api.github.com/users/winitzki/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-06T01:13:32Z","updated_at":"2018-02-06T01:13:32Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"When generating a function such as `Option[A] => Option[A]`, the preferred implementation would be `x => x`. Sometimes code such as this is generated:\r\n\r\n```scala\r\nWarning:(141, 89) type (A ⇒ Option[B]{None.type + Some[B]}) ⇒ (B ⇒ Option[C]{None.type + Some[C]}) ⇒ A ⇒ Option[C]{None.type + Some[C]} has 2 implementations (laws need checking?):\r\n a ⇒ b ⇒ c ⇒ a c match { d ⇒ (None() + 0); e ⇒ b e.value } [score: (0,0.5,0.0,0,0)];\r\n a ⇒ b ⇒ c ⇒ (None() + 0) [score: (3,0.0,0.0,0,0)].\r\n    def kleisliOptCompose[A, B, C](f: A ⇒ Option[B], g: B ⇒ Option[C]): A ⇒ Option[C] = implement\r\n```\r\n\r\nIt is better to generate code such as `x match { d => d }; ... ` instead of  `x match { d => None() + 0 }; ... ` when `d` is itself already `None()`. This code would have a lower information loss score."}}
{"actor":{"display_login":"winitzki"}}