{"action":"created","issue":{"url":"https://api.github.com/repos/EdutainmentLIVE/haskell-style-guide/issues/23","repository_url":"https://api.github.com/repos/EdutainmentLIVE/haskell-style-guide","labels_url":"https://api.github.com/repos/EdutainmentLIVE/haskell-style-guide/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/EdutainmentLIVE/haskell-style-guide/issues/23/comments","events_url":"https://api.github.com/repos/EdutainmentLIVE/haskell-style-guide/issues/23/events","html_url":"https://github.com/EdutainmentLIVE/haskell-style-guide/issues/23","id":315303415,"node_id":"MDU6SXNzdWUzMTUzMDM0MTU=","number":23,"title":"Always derive at least Eq and Show","user":{"login":"tfausak","id":408753,"node_id":"MDQ6VXNlcjQwODc1Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/408753?v=4","gravatar_id":"","url":"https://api.github.com/users/tfausak","html_url":"https://github.com/tfausak","followers_url":"https://api.github.com/users/tfausak/followers","following_url":"https://api.github.com/users/tfausak/following{/other_user}","gists_url":"https://api.github.com/users/tfausak/gists{/gist_id}","starred_url":"https://api.github.com/users/tfausak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfausak/subscriptions","organizations_url":"https://api.github.com/users/tfausak/orgs","repos_url":"https://api.github.com/users/tfausak/repos","events_url":"https://api.github.com/users/tfausak/events{/privacy}","received_events_url":"https://api.github.com/users/tfausak/received_events","type":"User","site_admin":false},"labels":[{"id":890374410,"node_id":"MDU6TGFiZWw4OTAzNzQ0MTA=","url":"https://api.github.com/repos/EdutainmentLIVE/haskell-style-guide/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-04-18T02:08:49Z","updated_at":"2018-07-11T18:15:35Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"``` hs\r\n-- bad\r\ndata Switch = Off | On\r\n\r\n-- good\r\ndata Switch = Off | On deriving (Eq, Show)\r\n```\r\n\r\nTo make debugging easier, every data type should derive the `Eq` and `Show` type classes. Other type class instances, like `Ord` and `Read`, are up to your discretion. "},"comment":{"url":"https://api.github.com/repos/EdutainmentLIVE/haskell-style-guide/issues/comments/404263083","html_url":"https://github.com/EdutainmentLIVE/haskell-style-guide/issues/23#issuecomment-404263083","issue_url":"https://api.github.com/repos/EdutainmentLIVE/haskell-style-guide/issues/23","id":404263083,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDI2MzA4Mw==","user":{"login":"tfausak","id":408753,"node_id":"MDQ6VXNlcjQwODc1Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/408753?v=4","gravatar_id":"","url":"https://api.github.com/users/tfausak","html_url":"https://github.com/tfausak","followers_url":"https://api.github.com/users/tfausak/followers","following_url":"https://api.github.com/users/tfausak/following{/other_user}","gists_url":"https://api.github.com/users/tfausak/gists{/gist_id}","starred_url":"https://api.github.com/users/tfausak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfausak/subscriptions","organizations_url":"https://api.github.com/users/tfausak/orgs","repos_url":"https://api.github.com/users/tfausak/repos","events_url":"https://api.github.com/users/tfausak/events{/privacy}","received_events_url":"https://api.github.com/users/tfausak/received_events","type":"User","site_admin":false},"created_at":"2018-07-11T18:15:35Z","updated_at":"2018-07-11T18:15:35Z","author_association":"CONTRIBUTOR","body":"To reiterate, `Eq` and `Show` are the fastest type classes to derive:\r\n\r\n![](https://taylor.fausak.me/static/images/2017/08/09/deriving-performance.svg)\r\n\r\nI'm willing to pay that price. \r\n\r\nThere are some types that shouldn't have `Show` instances. For example, anything sensitive like passwords.\r\n\r\n``` hs\r\nnewtype Password\r\n  = Password Text\r\n  -- doesn't derive `Show` to avoid accidentally printing it out\r\n```\r\n\r\nYou could manually provide an instance that hides the sensitive information:\r\n\r\n``` hs\r\nshowPassword :: Password -> Text\r\nshowPassword _ = \"Password \\\"[REDACTED]\\\"\"\r\n\r\ninstance Show Password where\r\n  show = showPassword\r\n```\r\n\r\nThat would also prevent future developers from accidentally adding `deriving Show`. "}}
{"actor":{"display_login":"tfausak"}}