{"action":"created","comment":{"url":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/comments/221237094","pull_request_review_id":159838884,"id":221237094,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTIzNzA5NA==","diff_hunk":"@@ -92,3 +95,132 @@ getBuiltinFix = do\n         $ [ Apply () (unrollFunAB unroll2) $ Var () s\n           , Var () x\n           ]\n+\n+-- | A type that looks a bit transformation.\n+--\n+-- > trans F G Q : F Q -> G Q\n+trans :: Type TyName () -> Type TyName () -> Type TyName () -> Quote (Type TyName ())\n+trans f g q = pure $ TyFun () (TyApp () f q) (TyApp () g q)\n+\n+-- | A type that looks like a natural transformation.\n+--\n+-- > natTrans F G : forall Q :: * . F Q -> G Q\n+natTrans :: Type TyName () -> Type TyName () -> Quote (Type TyName ())\n+natTrans f g = freshTyName () \"Q\" >>= \\q -> TyForall () q (Type ()) <$> trans f g (TyVar () q)\n+\n+-- | A type that looks like a natural transformation to Id.\n+--\n+-- > natTransId F : forall Q :: * . F Q -> Q\n+natTransId :: Type TyName () -> Quote (Type TyName ())\n+natTransId f = do\n+    q <- freshTyName () \"Q\"\n+    pure $ TyForall () q (Type ()) (TyFun () (TyApp () f (TyVar () q)) (TyVar () q))\n+\n+-- | The 'fixBy' combinator.\n+--\n+-- fixBy :\n+--     forall F :: (* -> *) .\n+--     ((forall Q :: * . F Q -> Q) -> (forall Q :: * . F Q -> Q)) ->\n+--     ((forall Q :: * . F Q -> F Q) -> (forall Q :: * . F Q -> Q))\n+getBuiltinFixBy :: Quote (Term TyName Name ())\n+getBuiltinFixBy = do\n+    f <- freshTyName () \"F\"\n+    by <- freshName () \"by\"\n+    byTy <- do\n+        nt1 <- natTransId (TyVar () f)\n+        nt2 <- natTransId (TyVar () f)\n+        pure $ TyFun () nt1 nt2\n+\n+    instantiatedFix <- do\n+        fix <- getBuiltinFix\n+        nt1 <- natTrans (TyVar () f) (TyVar () f)\n+        nt2 <- natTransId (TyVar () f)\n+        pure $ TyInst () (TyInst () fix nt1) nt2","path":"language-plutus-core/stdlib/Language/PlutusCore/StdLib/Data/Function.hs","position":61,"original_position":61,"commit_id":"dc4fa54167b03f573a3cb68e9a68b0ee364c1065","original_commit_id":"dc4fa54167b03f573a3cb68e9a68b0ee364c1065","user":{"login":"effectfully","id":10480926,"node_id":"MDQ6VXNlcjEwNDgwOTI2","avatar_url":"https://avatars1.githubusercontent.com/u/10480926?v=4","gravatar_id":"","url":"https://api.github.com/users/effectfully","html_url":"https://github.com/effectfully","followers_url":"https://api.github.com/users/effectfully/followers","following_url":"https://api.github.com/users/effectfully/following{/other_user}","gists_url":"https://api.github.com/users/effectfully/gists{/gist_id}","starred_url":"https://api.github.com/users/effectfully/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/effectfully/subscriptions","organizations_url":"https://api.github.com/users/effectfully/orgs","repos_url":"https://api.github.com/users/effectfully/repos","events_url":"https://api.github.com/users/effectfully/events{/privacy}","received_events_url":"https://api.github.com/users/effectfully/received_events","type":"User","site_admin":false},"body":"Very nice idea to write it like this, I'm going to steal it.","created_at":"2018-09-28T12:33:21Z","updated_at":"2018-09-28T12:59:50Z","html_url":"https://github.com/input-output-hk/plutus-prototype/pull/151#discussion_r221237094","pull_request_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/151","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/comments/221237094"},"html":{"href":"https://github.com/input-output-hk/plutus-prototype/pull/151#discussion_r221237094"},"pull_request":{"href":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/151"}}},"pull_request":{"url":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/151","id":218938466,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4OTM4NDY2","html_url":"https://github.com/input-output-hk/plutus-prototype/pull/151","diff_url":"https://github.com/input-output-hk/plutus-prototype/pull/151.diff","patch_url":"https://github.com/input-output-hk/plutus-prototype/pull/151.patch","issue_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/issues/151","number":151,"state":"open","locked":false,"title":"language-plutus-core: add fixN","user":{"login":"michaelpj","id":1699466,"node_id":"MDQ6VXNlcjE2OTk0NjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1699466?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelpj","html_url":"https://github.com/michaelpj","followers_url":"https://api.github.com/users/michaelpj/followers","following_url":"https://api.github.com/users/michaelpj/following{/other_user}","gists_url":"https://api.github.com/users/michaelpj/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelpj/subscriptions","organizations_url":"https://api.github.com/users/michaelpj/orgs","repos_url":"https://api.github.com/users/michaelpj/repos","events_url":"https://api.github.com/users/michaelpj/events{/privacy}","received_events_url":"https://api.github.com/users/michaelpj/received_events","type":"User","site_admin":false},"body":"This adds Roman's marvellous n-ary fixpoint operator to the standard library. We still can't typecheck it, since it has non-normalized types in it, but it seems to work!\r\n\r\nMy tests could probably be made into actual property tests that check that the functions are equivalent to the Haskell variants, but I have some other things I need to do today, so I'll leave that for the future.\r\n\r\nDefining the test examples is something of a battle too. I have some ideas to make this better, but for later.","created_at":"2018-09-28T11:31:38Z","updated_at":"2018-09-28T12:59:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b91e8207e1539d14781957bf2acd712fea3c256b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/151/commits","review_comments_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/151/comments","review_comment_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/comments{/number}","comments_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/issues/151/comments","statuses_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/statuses/dc4fa54167b03f573a3cb68e9a68b0ee364c1065","head":{"label":"michaelpj:imp/nary-fix","ref":"imp/nary-fix","sha":"dc4fa54167b03f573a3cb68e9a68b0ee364c1065","user":{"login":"michaelpj","id":1699466,"node_id":"MDQ6VXNlcjE2OTk0NjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1699466?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelpj","html_url":"https://github.com/michaelpj","followers_url":"https://api.github.com/users/michaelpj/followers","following_url":"https://api.github.com/users/michaelpj/following{/other_user}","gists_url":"https://api.github.com/users/michaelpj/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelpj/subscriptions","organizations_url":"https://api.github.com/users/michaelpj/orgs","repos_url":"https://api.github.com/users/michaelpj/repos","events_url":"https://api.github.com/users/michaelpj/events{/privacy}","received_events_url":"https://api.github.com/users/michaelpj/received_events","type":"User","site_admin":false},"repo":{"id":141337224,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEzMzcyMjQ=","name":"plutus-prototype","full_name":"michaelpj/plutus-prototype","private":false,"owner":{"login":"michaelpj","id":1699466,"node_id":"MDQ6VXNlcjE2OTk0NjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1699466?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelpj","html_url":"https://github.com/michaelpj","followers_url":"https://api.github.com/users/michaelpj/followers","following_url":"https://api.github.com/users/michaelpj/following{/other_user}","gists_url":"https://api.github.com/users/michaelpj/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelpj/subscriptions","organizations_url":"https://api.github.com/users/michaelpj/orgs","repos_url":"https://api.github.com/users/michaelpj/repos","events_url":"https://api.github.com/users/michaelpj/events{/privacy}","received_events_url":"https://api.github.com/users/michaelpj/received_events","type":"User","site_admin":false},"html_url":"https://github.com/michaelpj/plutus-prototype","description":null,"fork":true,"url":"https://api.github.com/repos/michaelpj/plutus-prototype","forks_url":"https://api.github.com/repos/michaelpj/plutus-prototype/forks","keys_url":"https://api.github.com/repos/michaelpj/plutus-prototype/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaelpj/plutus-prototype/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaelpj/plutus-prototype/teams","hooks_url":"https://api.github.com/repos/michaelpj/plutus-prototype/hooks","issue_events_url":"https://api.github.com/repos/michaelpj/plutus-prototype/issues/events{/number}","events_url":"https://api.github.com/repos/michaelpj/plutus-prototype/events","assignees_url":"https://api.github.com/repos/michaelpj/plutus-prototype/assignees{/user}","branches_url":"https://api.github.com/repos/michaelpj/plutus-prototype/branches{/branch}","tags_url":"https://api.github.com/repos/michaelpj/plutus-prototype/tags","blobs_url":"https://api.github.com/repos/michaelpj/plutus-prototype/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaelpj/plutus-prototype/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaelpj/plutus-prototype/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaelpj/plutus-prototype/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaelpj/plutus-prototype/statuses/{sha}","languages_url":"https://api.github.com/repos/michaelpj/plutus-prototype/languages","stargazers_url":"https://api.github.com/repos/michaelpj/plutus-prototype/stargazers","contributors_url":"https://api.github.com/repos/michaelpj/plutus-prototype/contributors","subscribers_url":"https://api.github.com/repos/michaelpj/plutus-prototype/subscribers","subscription_url":"https://api.github.com/repos/michaelpj/plutus-prototype/subscription","commits_url":"https://api.github.com/repos/michaelpj/plutus-prototype/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaelpj/plutus-prototype/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaelpj/plutus-prototype/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaelpj/plutus-prototype/issues/comments{/number}","contents_url":"https://api.github.com/repos/michaelpj/plutus-prototype/contents/{+path}","compare_url":"https://api.github.com/repos/michaelpj/plutus-prototype/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaelpj/plutus-prototype/merges","archive_url":"https://api.github.com/repos/michaelpj/plutus-prototype/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaelpj/plutus-prototype/downloads","issues_url":"https://api.github.com/repos/michaelpj/plutus-prototype/issues{/number}","pulls_url":"https://api.github.com/repos/michaelpj/plutus-prototype/pulls{/number}","milestones_url":"https://api.github.com/repos/michaelpj/plutus-prototype/milestones{/number}","notifications_url":"https://api.github.com/repos/michaelpj/plutus-prototype/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaelpj/plutus-prototype/labels{/name}","releases_url":"https://api.github.com/repos/michaelpj/plutus-prototype/releases{/id}","deployments_url":"https://api.github.com/repos/michaelpj/plutus-prototype/deployments","created_at":"2018-07-17T19:57:14Z","updated_at":"2018-07-17T19:57:16Z","pushed_at":"2018-09-28T12:58:50Z","git_url":"git://github.com/michaelpj/plutus-prototype.git","ssh_url":"git@github.com:michaelpj/plutus-prototype.git","clone_url":"https://github.com/michaelpj/plutus-prototype.git","svn_url":"https://github.com/michaelpj/plutus-prototype","homepage":null,"size":8043,"stargazers_count":0,"watchers_count":0,"language":"Nix","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"input-output-hk:master","ref":"master","sha":"dd39eb3f63657d53adcc2c0843e94aa27e88dd64","user":{"login":"input-output-hk","id":12909177,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyOTA5MTc3","avatar_url":"https://avatars3.githubusercontent.com/u/12909177?v=4","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"repo":{"id":73861563,"node_id":"MDEwOlJlcG9zaXRvcnk3Mzg2MTU2Mw==","name":"plutus-prototype","full_name":"input-output-hk/plutus-prototype","private":false,"owner":{"login":"input-output-hk","id":12909177,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyOTA5MTc3","avatar_url":"https://avatars3.githubusercontent.com/u/12909177?v=4","gravatar_id":"","url":"https://api.github.com/users/input-output-hk","html_url":"https://github.com/input-output-hk","followers_url":"https://api.github.com/users/input-output-hk/followers","following_url":"https://api.github.com/users/input-output-hk/following{/other_user}","gists_url":"https://api.github.com/users/input-output-hk/gists{/gist_id}","starred_url":"https://api.github.com/users/input-output-hk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/input-output-hk/subscriptions","organizations_url":"https://api.github.com/users/input-output-hk/orgs","repos_url":"https://api.github.com/users/input-output-hk/repos","events_url":"https://api.github.com/users/input-output-hk/events{/privacy}","received_events_url":"https://api.github.com/users/input-output-hk/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/input-output-hk/plutus-prototype","description":"The Plutus language reference implementation and tools","fork":false,"url":"https://api.github.com/repos/input-output-hk/plutus-prototype","forks_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/forks","keys_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/keys{/key_id}","collaborators_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/teams","hooks_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/hooks","issue_events_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/issues/events{/number}","events_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/events","assignees_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/assignees{/user}","branches_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/branches{/branch}","tags_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/tags","blobs_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/git/refs{/sha}","trees_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/git/trees{/sha}","statuses_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/statuses/{sha}","languages_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/languages","stargazers_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/stargazers","contributors_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/contributors","subscribers_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/subscribers","subscription_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/subscription","commits_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/commits{/sha}","git_commits_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/git/commits{/sha}","comments_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/comments{/number}","issue_comment_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/issues/comments{/number}","contents_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/contents/{+path}","compare_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/compare/{base}...{head}","merges_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/merges","archive_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/downloads","issues_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/issues{/number}","pulls_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls{/number}","milestones_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/milestones{/number}","notifications_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/labels{/name}","releases_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/releases{/id}","deployments_url":"https://api.github.com/repos/input-output-hk/plutus-prototype/deployments","created_at":"2016-11-15T22:38:43Z","updated_at":"2018-09-27T08:28:21Z","pushed_at":"2018-09-28T11:31:39Z","git_url":"git://github.com/input-output-hk/plutus-prototype.git","ssh_url":"git@github.com:input-output-hk/plutus-prototype.git","clone_url":"https://github.com/input-output-hk/plutus-prototype.git","svn_url":"https://github.com/input-output-hk/plutus-prototype","homepage":"","size":7993,"stargazers_count":131,"watchers_count":131,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":23,"open_issues":11,"watchers":131,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/151"},"html":{"href":"https://github.com/input-output-hk/plutus-prototype/pull/151"},"issue":{"href":"https://api.github.com/repos/input-output-hk/plutus-prototype/issues/151"},"comments":{"href":"https://api.github.com/repos/input-output-hk/plutus-prototype/issues/151/comments"},"review_comments":{"href":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/151/comments"},"review_comment":{"href":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/input-output-hk/plutus-prototype/pulls/151/commits"},"statuses":{"href":"https://api.github.com/repos/input-output-hk/plutus-prototype/statuses/dc4fa54167b03f573a3cb68e9a68b0ee364c1065"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"effectfully"}}