{"action":"created","issue":{"url":"https://api.github.com/repos/FStarLang/FStar/issues/649","repository_url":"https://api.github.com/repos/FStarLang/FStar","labels_url":"https://api.github.com/repos/FStarLang/FStar/issues/649/labels{/name}","comments_url":"https://api.github.com/repos/FStarLang/FStar/issues/649/comments","events_url":"https://api.github.com/repos/FStarLang/FStar/issues/649/events","html_url":"https://github.com/FStarLang/FStar/issues/649","id":173649207,"number":649,"title":"How does one type a function that may return different types? ","user":{"login":"A-Manning","id":10554686,"avatar_url":"https://avatars.githubusercontent.com/u/10554686?v=3","gravatar_id":"","url":"https://api.github.com/users/A-Manning","html_url":"https://github.com/A-Manning","followers_url":"https://api.github.com/users/A-Manning/followers","following_url":"https://api.github.com/users/A-Manning/following{/other_user}","gists_url":"https://api.github.com/users/A-Manning/gists{/gist_id}","starred_url":"https://api.github.com/users/A-Manning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/A-Manning/subscriptions","organizations_url":"https://api.github.com/users/A-Manning/orgs","repos_url":"https://api.github.com/users/A-Manning/repos","events_url":"https://api.github.com/users/A-Manning/events{/privacy}","received_events_url":"https://api.github.com/users/A-Manning/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-08-28T14:24:27Z","updated_at":"2016-08-30T23:57:39Z","closed_at":"2016-08-30T23:57:38Z","body":"I can create the following refinement types; \r\n\r\n```\r\ntype odd = x:int{x%2 = 1}\r\ntype even = x:int{x%2 = 0}\r\n```\r\n\r\nHow would I write a function that takes an integer and returns it's refinement? \r\n\r\nsomething like \r\n\r\n```\r\nlet parity x = \r\n    | Odd x when x%2 = 1\r\n    | Even x when x%2 = 0\r\n```\r\n\r\nHow would I write the function? And what would the Val declaration look like? "},"comment":{"url":"https://api.github.com/repos/FStarLang/FStar/issues/comments/243618551","html_url":"https://github.com/FStarLang/FStar/issues/649#issuecomment-243618551","issue_url":"https://api.github.com/repos/FStarLang/FStar/issues/649","id":243618551,"user":{"login":"msprotz","id":10673049,"avatar_url":"https://avatars.githubusercontent.com/u/10673049?v=3","gravatar_id":"","url":"https://api.github.com/users/msprotz","html_url":"https://github.com/msprotz","followers_url":"https://api.github.com/users/msprotz/followers","following_url":"https://api.github.com/users/msprotz/following{/other_user}","gists_url":"https://api.github.com/users/msprotz/gists{/gist_id}","starred_url":"https://api.github.com/users/msprotz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msprotz/subscriptions","organizations_url":"https://api.github.com/users/msprotz/orgs","repos_url":"https://api.github.com/users/msprotz/repos","events_url":"https://api.github.com/users/msprotz/events{/privacy}","received_events_url":"https://api.github.com/users/msprotz/received_events","type":"User","site_admin":false},"created_at":"2016-08-30T23:57:38Z","updated_at":"2016-08-30T23:57:38Z","body":"and `let value = function` is syntactic sugar for `let value x = match x with`... feel free to reopen if other questions pop up."}}
{"actor":{"display_login":"msprotz"}}