{"action":"created","issue":{"url":"https://api.github.com/repos/VinylRecords/Vinyl/issues/86","repository_url":"https://api.github.com/repos/VinylRecords/Vinyl","labels_url":"https://api.github.com/repos/VinylRecords/Vinyl/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/VinylRecords/Vinyl/issues/86/comments","events_url":"https://api.github.com/repos/VinylRecords/Vinyl/issues/86/events","html_url":"https://github.com/VinylRecords/Vinyl/issues/86","id":139198393,"number":86,"title":"Setting all the fields but one to the Default value","user":{"login":"meditans","id":4641445,"avatar_url":"https://avatars.githubusercontent.com/u/4641445?v=3","gravatar_id":"","url":"https://api.github.com/users/meditans","html_url":"https://github.com/meditans","followers_url":"https://api.github.com/users/meditans/followers","following_url":"https://api.github.com/users/meditans/following{/other_user}","gists_url":"https://api.github.com/users/meditans/gists{/gist_id}","starred_url":"https://api.github.com/users/meditans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meditans/subscriptions","organizations_url":"https://api.github.com/users/meditans/orgs","repos_url":"https://api.github.com/users/meditans/repos","events_url":"https://api.github.com/users/meditans/events{/privacy}","received_events_url":"https://api.github.com/users/meditans/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-03-08T07:08:06Z","updated_at":"2016-03-08T15:11:50Z","closed_at":null,"body":"Hi,\r\n\r\nthis is a question on vinyl usage, posted here because I didn't find a more suitable place.\r\n\r\nThe problem is the following: following `vinyl` tutorial, I have a promoted type meant to tag the fields of the record, and an interpretation type family `Attr` mapping it to concrete types of my choice. Let's say the promoted type is:\r\n\r\n```haskell\r\ndata Tag = Foo1 | Foo2 | Foo3 | Bar\r\n```\r\n\r\nI also happen to have a `Default` instance for `Attr Foo1` to `Attr Foo3`, but I don't have it for `Attr Bar`.\r\n\r\nI'd like to write a function, `bar1`, which takes no parameters, and sets the `Bar` value in the record to a specified constant, while putting the other fields to their `Default` value.\r\n\r\nSo, I'd like the signature to be along the lines of:\r\n\r\n```haskell\r\nbar1 :: (RecAll Attr (rs `Excluding` 'Bar) Default, 'Bar ∈ rs) => Rec Attr rs\r\n```\r\n\r\nwhere `Excluding` could be defined as:\r\n\r\n```haskell\r\ntype family Excluding (as :: [k]) (a :: k) :: [k] where\r\n  Excluding '[] a       = '[]\r\n  Excluding (a ': as) a =      Excluding as a\r\n  Excluding (b ': as) a = b ': Excluding as a\r\n```\r\n\r\nUnfortunately, I've not been able to write the definition of the function. Could you give me some hints on how to do that?\r\n"},"comment":{"url":"https://api.github.com/repos/VinylRecords/Vinyl/issues/comments/193818283","html_url":"https://github.com/VinylRecords/Vinyl/issues/86#issuecomment-193818283","issue_url":"https://api.github.com/repos/VinylRecords/Vinyl/issues/86","id":193818283,"user":{"login":"andrewthad","id":5332484,"avatar_url":"https://avatars.githubusercontent.com/u/5332484?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewthad","html_url":"https://github.com/andrewthad","followers_url":"https://api.github.com/users/andrewthad/followers","following_url":"https://api.github.com/users/andrewthad/following{/other_user}","gists_url":"https://api.github.com/users/andrewthad/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewthad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewthad/subscriptions","organizations_url":"https://api.github.com/users/andrewthad/orgs","repos_url":"https://api.github.com/users/andrewthad/repos","events_url":"https://api.github.com/users/andrewthad/events{/privacy}","received_events_url":"https://api.github.com/users/andrewthad/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T15:11:50Z","updated_at":"2016-03-08T15:11:50Z","body":"Also, in the example of `bar1` you gave above, you wrote:\r\n\r\n    bar1 :: (Default (Attr r), Default (Rec Attr rs)) => Rec Attr ('Bar ': r ': rs)\r\n    bar1 = (SBar =:: barStar) :& def\r\n\r\nBut you should have been able to write:\r\n\r\n    bar1 :: (Default (Rec Attr rs)) => Rec Attr ('Bar ': rs)\r\n    bar1 = (SBar =:: barStar) :& def\r\n"}}