{"action":"created","comment":{"url":"https://api.github.com/repos/ocaml/dune/pulls/comments/233075837","pull_request_review_id":174410547,"id":233075837,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzA3NTgzNw==","diff_hunk":"@@ -0,0 +1,27 @@\n+open Stdune\n+open Memoization\n+open Memoization_specs\n+\n+module Id = Id.Make ()\n+\n+type 'a t = Id.t * 'a Fiber.t -> 'a Fiber.t\n+\n+let id_input_spec =\n+  let ser x = Id.to_int x |> string_of_int in\n+  let ne x y = x <> y in\n+  {\n+    serialize = ser;\n+    print = ser;\n+    not_equal = ne;","path":"src/memoization_cached.ml","position":15,"original_position":15,"commit_id":"46361b22d92d385e24480eb3b602423abc2c1e36","original_commit_id":"249775781d8d493806ca35f80b131e1ed7101408","user":{"login":"emillon","id":496345,"node_id":"MDQ6VXNlcjQ5NjM0NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/496345?v=4","gravatar_id":"","url":"https://api.github.com/users/emillon","html_url":"https://github.com/emillon","followers_url":"https://api.github.com/users/emillon/followers","following_url":"https://api.github.com/users/emillon/following{/other_user}","gists_url":"https://api.github.com/users/emillon/gists{/gist_id}","starred_url":"https://api.github.com/users/emillon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emillon/subscriptions","organizations_url":"https://api.github.com/users/emillon/orgs","repos_url":"https://api.github.com/users/emillon/repos","events_url":"https://api.github.com/users/emillon/events{/privacy}","received_events_url":"https://api.github.com/users/emillon/received_events","type":"User","site_admin":false},"body":"yes, more precisely `let serialize = ... in let not_equal = ... in { serialize; print = serialize; not_equal}`. Otherwise I'm fine with the current version.","created_at":"2018-11-13T15:08:35Z","updated_at":"2018-11-13T15:08:35Z","html_url":"https://github.com/ocaml/dune/pull/1489#discussion_r233075837","pull_request_url":"https://api.github.com/repos/ocaml/dune/pulls/1489","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/ocaml/dune/pulls/comments/233075837"},"html":{"href":"https://github.com/ocaml/dune/pull/1489#discussion_r233075837"},"pull_request":{"href":"https://api.github.com/repos/ocaml/dune/pulls/1489"}},"in_reply_to_id":232976845},"pull_request":{"url":"https://api.github.com/repos/ocaml/dune/pulls/1489","id":224961233,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0OTYxMjMz","html_url":"https://github.com/ocaml/dune/pull/1489","diff_url":"https://github.com/ocaml/dune/pull/1489.diff","patch_url":"https://github.com/ocaml/dune/pull/1489.patch","issue_url":"https://api.github.com/repos/ocaml/dune/issues/1489","number":1489,"state":"open","locked":false,"title":"Memoization function","user":{"login":"rudihorn","id":6114830,"node_id":"MDQ6VXNlcjYxMTQ4MzA=","avatar_url":"https://avatars2.githubusercontent.com/u/6114830?v=4","gravatar_id":"","url":"https://api.github.com/users/rudihorn","html_url":"https://github.com/rudihorn","followers_url":"https://api.github.com/users/rudihorn/followers","following_url":"https://api.github.com/users/rudihorn/following{/other_user}","gists_url":"https://api.github.com/users/rudihorn/gists{/gist_id}","starred_url":"https://api.github.com/users/rudihorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudihorn/subscriptions","organizations_url":"https://api.github.com/users/rudihorn/orgs","repos_url":"https://api.github.com/users/rudihorn/repos","events_url":"https://api.github.com/users/rudihorn/events{/privacy}","received_events_url":"https://api.github.com/users/rudihorn/received_events","type":"User","site_admin":false},"body":"This is referencing the computation model specified in #1280. The goal has been to implement a memoization function which takes a computation of the form `'a -> 'b Fiber.t` and returns a computation `'a -> 'b Fiber.t` which additionally performs:\r\n* Dependency tracking\r\n* Output caching with early cut-off\r\n* Cycle detection\r\n\r\nCurrently the memoization function has been implemented and is able to perform these three functions. An example of how to use the memoization functions is shown in `test/unit-tests/memoize.mlt`. Below is an example of how one could use the system to implement a Fibonacci sequence which is automatically cached between computations.\r\n\r\n```\r\nlet mfib = \r\n  let mfib = CRef.deferred () in\r\n  let compfib x =\r\n    let mfib = CRef.get mfib in\r\n    counter := !counter + 1;\r\n    if x <= 1 then\r\n      Fiber.return x\r\n    else\r\n      mfib (x - 1)\r\n      >>= (fun r1 ->\r\n        mfib (x - 2)\r\n        >>| fun r2 -> r1 + r2) in\r\n  memoization iimemcached \"fib\" int_input_spec int_output_spec compfib |> CRef.set mfib;\r\n  CRef.get mfib;;\r\n```\r\n\r\nThere has been a little bit of progress to change `build_system.ml` so that the actual build process is a little more abstracted to make it easier to drop in the `memoization` function and remove the current caching etc. This bit is still a little bit of a mess however, and in essence it just breaks existing caching (for now). \r\n\r\nFeedback welcome.","created_at":"2018-10-23T09:24:35Z","updated_at":"2018-11-13T15:08:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b2cbfd4f59b10b3d1af608381e77b0e31e0ebd9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ocaml/dune/pulls/1489/commits","review_comments_url":"https://api.github.com/repos/ocaml/dune/pulls/1489/comments","review_comment_url":"https://api.github.com/repos/ocaml/dune/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ocaml/dune/issues/1489/comments","statuses_url":"https://api.github.com/repos/ocaml/dune/statuses/46361b22d92d385e24480eb3b602423abc2c1e36","head":{"label":"rudihorn:memoization","ref":"memoization","sha":"46361b22d92d385e24480eb3b602423abc2c1e36","user":{"login":"rudihorn","id":6114830,"node_id":"MDQ6VXNlcjYxMTQ4MzA=","avatar_url":"https://avatars2.githubusercontent.com/u/6114830?v=4","gravatar_id":"","url":"https://api.github.com/users/rudihorn","html_url":"https://github.com/rudihorn","followers_url":"https://api.github.com/users/rudihorn/followers","following_url":"https://api.github.com/users/rudihorn/following{/other_user}","gists_url":"https://api.github.com/users/rudihorn/gists{/gist_id}","starred_url":"https://api.github.com/users/rudihorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudihorn/subscriptions","organizations_url":"https://api.github.com/users/rudihorn/orgs","repos_url":"https://api.github.com/users/rudihorn/repos","events_url":"https://api.github.com/users/rudihorn/events{/privacy}","received_events_url":"https://api.github.com/users/rudihorn/received_events","type":"User","site_admin":false},"repo":{"id":153112526,"node_id":"MDEwOlJlcG9zaXRvcnkxNTMxMTI1MjY=","name":"dune","full_name":"rudihorn/dune","private":false,"owner":{"login":"rudihorn","id":6114830,"node_id":"MDQ6VXNlcjYxMTQ4MzA=","avatar_url":"https://avatars2.githubusercontent.com/u/6114830?v=4","gravatar_id":"","url":"https://api.github.com/users/rudihorn","html_url":"https://github.com/rudihorn","followers_url":"https://api.github.com/users/rudihorn/followers","following_url":"https://api.github.com/users/rudihorn/following{/other_user}","gists_url":"https://api.github.com/users/rudihorn/gists{/gist_id}","starred_url":"https://api.github.com/users/rudihorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudihorn/subscriptions","organizations_url":"https://api.github.com/users/rudihorn/orgs","repos_url":"https://api.github.com/users/rudihorn/repos","events_url":"https://api.github.com/users/rudihorn/events{/privacy}","received_events_url":"https://api.github.com/users/rudihorn/received_events","type":"User","site_admin":false},"html_url":"https://github.com/rudihorn/dune","description":"A composable build system for OCaml","fork":true,"url":"https://api.github.com/repos/rudihorn/dune","forks_url":"https://api.github.com/repos/rudihorn/dune/forks","keys_url":"https://api.github.com/repos/rudihorn/dune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rudihorn/dune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rudihorn/dune/teams","hooks_url":"https://api.github.com/repos/rudihorn/dune/hooks","issue_events_url":"https://api.github.com/repos/rudihorn/dune/issues/events{/number}","events_url":"https://api.github.com/repos/rudihorn/dune/events","assignees_url":"https://api.github.com/repos/rudihorn/dune/assignees{/user}","branches_url":"https://api.github.com/repos/rudihorn/dune/branches{/branch}","tags_url":"https://api.github.com/repos/rudihorn/dune/tags","blobs_url":"https://api.github.com/repos/rudihorn/dune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rudihorn/dune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rudihorn/dune/git/refs{/sha}","trees_url":"https://api.github.com/repos/rudihorn/dune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rudihorn/dune/statuses/{sha}","languages_url":"https://api.github.com/repos/rudihorn/dune/languages","stargazers_url":"https://api.github.com/repos/rudihorn/dune/stargazers","contributors_url":"https://api.github.com/repos/rudihorn/dune/contributors","subscribers_url":"https://api.github.com/repos/rudihorn/dune/subscribers","subscription_url":"https://api.github.com/repos/rudihorn/dune/subscription","commits_url":"https://api.github.com/repos/rudihorn/dune/commits{/sha}","git_commits_url":"https://api.github.com/repos/rudihorn/dune/git/commits{/sha}","comments_url":"https://api.github.com/repos/rudihorn/dune/comments{/number}","issue_comment_url":"https://api.github.com/repos/rudihorn/dune/issues/comments{/number}","contents_url":"https://api.github.com/repos/rudihorn/dune/contents/{+path}","compare_url":"https://api.github.com/repos/rudihorn/dune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rudihorn/dune/merges","archive_url":"https://api.github.com/repos/rudihorn/dune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rudihorn/dune/downloads","issues_url":"https://api.github.com/repos/rudihorn/dune/issues{/number}","pulls_url":"https://api.github.com/repos/rudihorn/dune/pulls{/number}","milestones_url":"https://api.github.com/repos/rudihorn/dune/milestones{/number}","notifications_url":"https://api.github.com/repos/rudihorn/dune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rudihorn/dune/labels{/name}","releases_url":"https://api.github.com/repos/rudihorn/dune/releases{/id}","deployments_url":"https://api.github.com/repos/rudihorn/dune/deployments","created_at":"2018-10-15T12:53:35Z","updated_at":"2018-10-15T12:53:39Z","pushed_at":"2018-11-13T12:54:33Z","git_url":"git://github.com/rudihorn/dune.git","ssh_url":"git@github.com:rudihorn/dune.git","clone_url":"https://github.com/rudihorn/dune.git","svn_url":"https://github.com/rudihorn/dune","homepage":"","size":7474,"stargazers_count":0,"watchers_count":0,"language":"OCaml","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"ocaml:master","ref":"master","sha":"6556f7dfdf49329623848ca02f5cd6e0a5e418cb","user":{"login":"ocaml","id":1841483,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NDE0ODM=","avatar_url":"https://avatars3.githubusercontent.com/u/1841483?v=4","gravatar_id":"","url":"https://api.github.com/users/ocaml","html_url":"https://github.com/ocaml","followers_url":"https://api.github.com/users/ocaml/followers","following_url":"https://api.github.com/users/ocaml/following{/other_user}","gists_url":"https://api.github.com/users/ocaml/gists{/gist_id}","starred_url":"https://api.github.com/users/ocaml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocaml/subscriptions","organizations_url":"https://api.github.com/users/ocaml/orgs","repos_url":"https://api.github.com/users/ocaml/repos","events_url":"https://api.github.com/users/ocaml/events{/privacy}","received_events_url":"https://api.github.com/users/ocaml/received_events","type":"Organization","site_admin":false},"repo":{"id":72368050,"node_id":"MDEwOlJlcG9zaXRvcnk3MjM2ODA1MA==","name":"dune","full_name":"ocaml/dune","private":false,"owner":{"login":"ocaml","id":1841483,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NDE0ODM=","avatar_url":"https://avatars3.githubusercontent.com/u/1841483?v=4","gravatar_id":"","url":"https://api.github.com/users/ocaml","html_url":"https://github.com/ocaml","followers_url":"https://api.github.com/users/ocaml/followers","following_url":"https://api.github.com/users/ocaml/following{/other_user}","gists_url":"https://api.github.com/users/ocaml/gists{/gist_id}","starred_url":"https://api.github.com/users/ocaml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocaml/subscriptions","organizations_url":"https://api.github.com/users/ocaml/orgs","repos_url":"https://api.github.com/users/ocaml/repos","events_url":"https://api.github.com/users/ocaml/events{/privacy}","received_events_url":"https://api.github.com/users/ocaml/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ocaml/dune","description":"A composable build system for OCaml","fork":false,"url":"https://api.github.com/repos/ocaml/dune","forks_url":"https://api.github.com/repos/ocaml/dune/forks","keys_url":"https://api.github.com/repos/ocaml/dune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocaml/dune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocaml/dune/teams","hooks_url":"https://api.github.com/repos/ocaml/dune/hooks","issue_events_url":"https://api.github.com/repos/ocaml/dune/issues/events{/number}","events_url":"https://api.github.com/repos/ocaml/dune/events","assignees_url":"https://api.github.com/repos/ocaml/dune/assignees{/user}","branches_url":"https://api.github.com/repos/ocaml/dune/branches{/branch}","tags_url":"https://api.github.com/repos/ocaml/dune/tags","blobs_url":"https://api.github.com/repos/ocaml/dune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocaml/dune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocaml/dune/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocaml/dune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocaml/dune/statuses/{sha}","languages_url":"https://api.github.com/repos/ocaml/dune/languages","stargazers_url":"https://api.github.com/repos/ocaml/dune/stargazers","contributors_url":"https://api.github.com/repos/ocaml/dune/contributors","subscribers_url":"https://api.github.com/repos/ocaml/dune/subscribers","subscription_url":"https://api.github.com/repos/ocaml/dune/subscription","commits_url":"https://api.github.com/repos/ocaml/dune/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocaml/dune/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocaml/dune/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocaml/dune/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocaml/dune/contents/{+path}","compare_url":"https://api.github.com/repos/ocaml/dune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocaml/dune/merges","archive_url":"https://api.github.com/repos/ocaml/dune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocaml/dune/downloads","issues_url":"https://api.github.com/repos/ocaml/dune/issues{/number}","pulls_url":"https://api.github.com/repos/ocaml/dune/pulls{/number}","milestones_url":"https://api.github.com/repos/ocaml/dune/milestones{/number}","notifications_url":"https://api.github.com/repos/ocaml/dune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocaml/dune/labels{/name}","releases_url":"https://api.github.com/repos/ocaml/dune/releases{/id}","deployments_url":"https://api.github.com/repos/ocaml/dune/deployments","created_at":"2016-10-30T18:42:23Z","updated_at":"2018-11-13T08:39:07Z","pushed_at":"2018-11-13T12:54:35Z","git_url":"git://github.com/ocaml/dune.git","ssh_url":"git@github.com:ocaml/dune.git","clone_url":"https://github.com/ocaml/dune.git","svn_url":"https://github.com/ocaml/dune","homepage":"","size":7582,"stargazers_count":535,"watchers_count":535,"language":"OCaml","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":112,"mirror_url":null,"archived":false,"open_issues_count":209,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":112,"open_issues":209,"watchers":535,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ocaml/dune/pulls/1489"},"html":{"href":"https://github.com/ocaml/dune/pull/1489"},"issue":{"href":"https://api.github.com/repos/ocaml/dune/issues/1489"},"comments":{"href":"https://api.github.com/repos/ocaml/dune/issues/1489/comments"},"review_comments":{"href":"https://api.github.com/repos/ocaml/dune/pulls/1489/comments"},"review_comment":{"href":"https://api.github.com/repos/ocaml/dune/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ocaml/dune/pulls/1489/commits"},"statuses":{"href":"https://api.github.com/repos/ocaml/dune/statuses/46361b22d92d385e24480eb3b602423abc2c1e36"}},"author_association":"NONE"}}
{"actor":{"display_login":"emillon"}}