{"action":"created","issue":{"url":"https://api.github.com/repos/andrewthad/yesod-table/issues/7","labels_url":"https://api.github.com/repos/andrewthad/yesod-table/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/andrewthad/yesod-table/issues/7/comments","events_url":"https://api.github.com/repos/andrewthad/yesod-table/issues/7/events","html_url":"https://github.com/andrewthad/yesod-table/issues/7","id":128352173,"number":7,"title":"How to add a Maybe value","user":{"login":"amitaibu","id":125707,"avatar_url":"https://avatars.githubusercontent.com/u/125707?v=3","gravatar_id":"","url":"https://api.github.com/users/amitaibu","html_url":"https://github.com/amitaibu","followers_url":"https://api.github.com/users/amitaibu/followers","following_url":"https://api.github.com/users/amitaibu/following{/other_user}","gists_url":"https://api.github.com/users/amitaibu/gists{/gist_id}","starred_url":"https://api.github.com/users/amitaibu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitaibu/subscriptions","organizations_url":"https://api.github.com/users/amitaibu/orgs","repos_url":"https://api.github.com/users/amitaibu/repos","events_url":"https://api.github.com/users/amitaibu/events{/privacy}","received_events_url":"https://api.github.com/users/amitaibu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-23T20:55:03Z","updated_at":"2016-01-25T13:16:45Z","closed_at":null,"body":"I've seen `Table.maybe` but not sure how to use it.\r\n\r\nI've got \r\n\r\n```haskell\r\n\r\ngetPeopleR :: Handler Html\r\ngetPeopleR = do\r\n    people <- runDB $ selectList [] [ Desc UserId ] :: Handler [Entity User]\r\n\r\n    let ppl = map entityVal people\r\n\r\n    defaultLayout $ do\r\n        setTitle \"People List\"\r\n        Table.buildBootstrap peopleTable ppl\r\n\r\npeopleTable :: Table site User\r\npeopleTable = mempty\r\n    ++ Table.text   \"Username\"  userIdent\r\n    ++ Table.text   \"Email\"          userEmail -- This should be a maybe\r\n```\r\n\r\n`Email` is a `Maybe` - how would I print it?"},"comment":{"url":"https://api.github.com/repos/andrewthad/yesod-table/issues/comments/174505533","html_url":"https://github.com/andrewthad/yesod-table/issues/7#issuecomment-174505533","issue_url":"https://api.github.com/repos/andrewthad/yesod-table/issues/7","id":174505533,"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-01-25T13:16:45Z","updated_at":"2016-01-25T13:16:45Z","body":"Ah, you're right. The type of `Table.maybe (Table.text \"Email\" userEmail)` would end up being `Table site (Maybe User)` which isn't what you want. I think the only way to work `Table.maybe` into your original example would be pretty convoluted:\r\n\r\n    peopleTable :: Table site User\r\n    peopleTable = mempty\r\n        ++ Table.text   \"Username\"  userIdent\r\n        ++ contramap userEmail (Table.maybe (Table.text \"Email\" id))\r\n\r\nBut that's just awful, and you'd be way better off with `fromMaybe`.\r\n\r\nAlso, I realized that my definition of `itemsWithUsersTable` in the previous example I gave was wrong, and I've updated the comment to correct it.\r\n\r\nI'll leave this issue open to remind me to add documentation for `Table.maybe`."}}