payload: {"action":"opened","issue":{"url":"https://api.github.com/repos/stackbuilders/hspec-golden/issues/14","repository_url":"https://api.github.com/repos/stackbuilders/hspec-golden","labels_url":"https://api.github.com/repos/stackbuilders/hspec-golden/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/stackbuilders/hspec-golden/issues/14/comments","events_url":"https://api.github.com/repos/stackbuilders/hspec-golden/issues/14/events","html_url":"https://github.com/stackbuilders/hspec-golden/issues/14","id":537778735,"node_id":"MDU6SXNzdWU1Mzc3Nzg3MzU=","number":14,"title":"Using arbitrary instances to generate the golden files","user":{"login":"CristhianMotoche","id":8370088,"node_id":"MDQ6VXNlcjgzNzAwODg=","avatar_url":"https://avatars0.githubusercontent.com/u/8370088?v=4","gravatar_id":"","url":"https://api.github.com/users/CristhianMotoche","html_url":"https://github.com/CristhianMotoche","followers_url":"https://api.github.com/users/CristhianMotoche/followers","following_url":"https://api.github.com/users/CristhianMotoche/following{/other_user}","gists_url":"https://api.github.com/users/CristhianMotoche/gists{/gist_id}","starred_url":"https://api.github.com/users/CristhianMotoche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CristhianMotoche/subscriptions","organizations_url":"https://api.github.com/users/CristhianMotoche/orgs","repos_url":"https://api.github.com/users/CristhianMotoche/repos","events_url":"https://api.github.com/users/CristhianMotoche/events{/privacy}","received_events_url":"https://api.github.com/users/CristhianMotoche/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-12-13T21:09:39Z","updated_at":"2019-12-13T21:09:39Z","closed_at":null,"author_association":"COLLABORATOR","body":"[hspec-golden-aeson](https://github.com/plow-technologies/hspec-golden-aeson) uses arbitrary instances to generate the golden files for the aeson instances. I think the main reason is to ensure the property `(encode . decode) x == x`. However, I think it can be helpful to use some arbitrary value instead setting one manually. For instance:\r\n\r\n```hs\r\n-- Module.hs\r\ntoHTML :: User -> Html\r\ntoHTML User{..} = ...\r\n\r\n-- ModuleSpec.hs\r\ndescribe \"toHTML\" $\r\n   it \"generates a golden file for a User\" $\r\n       let user = User {..}\r\n         in defaultGolden \"toHTML.User\" (renderHTML $ toHTML user) \r\n```\r\nIt would be great to get the user automatically from a random example:\r\n\r\n```hs\r\ndescribe \"toHTML\" $\r\n   it \"generates a golden file for a User\" $\r\n         defaultGolden \"toHTML.User\" (renderHTML . toHTML) \r\n```\r\n\r\nI don't think arbitrary is required for this. [faker](https://github.com/gazay/faker) could be a nice option."}}
other: {"actor":{"display_login":"CristhianMotoche"}}