{"action":"created","issue":{"url":"https://api.github.com/repos/jml/graphql-api/issues/26","repository_url":"https://api.github.com/repos/jml/graphql-api","labels_url":"https://api.github.com/repos/jml/graphql-api/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/jml/graphql-api/issues/26/comments","events_url":"https://api.github.com/repos/jml/graphql-api/issues/26/events","html_url":"https://github.com/jml/graphql-api/pull/26","id":196228331,"number":26,"title":"Smart constructor for Name","user":{"login":"jml","id":125674,"avatar_url":"https://avatars.githubusercontent.com/u/125674?v=3","gravatar_id":"","url":"https://api.github.com/users/jml","html_url":"https://github.com/jml","followers_url":"https://api.github.com/users/jml/followers","following_url":"https://api.github.com/users/jml/following{/other_user}","gists_url":"https://api.github.com/users/jml/gists{/gist_id}","starred_url":"https://api.github.com/users/jml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jml/subscriptions","organizations_url":"https://api.github.com/users/jml/orgs","repos_url":"https://api.github.com/users/jml/repos","events_url":"https://api.github.com/users/jml/events{/privacy}","received_events_url":"https://api.github.com/users/jml/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-17T15:52:56Z","updated_at":"2016-12-17T22:53:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jml/graphql-api/pulls/26","html_url":"https://github.com/jml/graphql-api/pull/26","diff_url":"https://github.com/jml/graphql-api/pull/26.diff","patch_url":"https://github.com/jml/graphql-api/pull/26.patch"},"body":"The quest to remove TODOs never ends. Although this removes one, it makes another.\r\n\r\nBuilds on https://github.com/jml/graphql-api/pull/24, so review & merge that before reviewing this (or just review https://github.com/jml/graphql-api/pull/26/commits/ddbd8afbb4723f15236a039618a09a925cec0946).\r\n\r\nWas going to do QuickCheck instances in this as per #23 but this turned out to be more complicated than expected and also now I really have to go.\r\n\r\n## Smart constructor for Name\r\n\r\nName is restricted in value, so when we have something that accepts a `Name` as a parameter, it should be able to trust that it's valid.\r\n\r\nStopped exporting `Name` constructor and now export two constructors:\r\n\r\n 1. `makeName`\r\n 2. `unsafeMakeName`\r\n\r\nThey do what they say on the tin.\r\n\r\nThere are three use-cases for `unsafeMakeName`:\r\n\r\n 1. In tests, where we are passing a literal.\r\n 2. In `Definitions`, because we cannot get GHC to enforce a restricted set of values for a `Symbol`.\r\n 3. In `TypeApi`, because we're operating on Data.GraphQL.AST directly when we should be operating on a pre-restricted type. Noted as a TODO comment.\r\n\r\nI tried adding a `HasName` type class to `Definitions`, but couldn't figure it out in the ten minutes I gave myself.\r\n\r\n## Misc cleanups\r\n\r\n* Dropped superfluous parens\r\n"},"comment":{"url":"https://api.github.com/repos/jml/graphql-api/issues/comments/267792304","html_url":"https://github.com/jml/graphql-api/pull/26#issuecomment-267792304","issue_url":"https://api.github.com/repos/jml/graphql-api/issues/26","id":267792304,"user":{"login":"jml","id":125674,"avatar_url":"https://avatars.githubusercontent.com/u/125674?v=3","gravatar_id":"","url":"https://api.github.com/users/jml","html_url":"https://github.com/jml","followers_url":"https://api.github.com/users/jml/followers","following_url":"https://api.github.com/users/jml/following{/other_user}","gists_url":"https://api.github.com/users/jml/gists{/gist_id}","starred_url":"https://api.github.com/users/jml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jml/subscriptions","organizations_url":"https://api.github.com/users/jml/orgs","repos_url":"https://api.github.com/users/jml/repos","events_url":"https://api.github.com/users/jml/events{/privacy}","received_events_url":"https://api.github.com/users/jml/received_events","type":"User","site_admin":false},"created_at":"2016-12-17T22:53:51Z","updated_at":"2016-12-17T22:53:51Z","body":"Sorry about rebase. Had a brain fart. Done now.\r\n\r\nAlso removed the `IsString` instance from `Name`, as it was allowing constructing invalid names. We could re-introduce it and have it panic, which wouldn't be so bad as it would only ever be called on literals. I thought about that and thought that probably it would be less surprising for users if they had to be explicit about it."}}
{"actor":{"display_login":"jml"}}