{"id":19010384,"url":"https://github.com/pcattori/ocaml-cheatsheet","last_synced_at":"2026-04-24T07:30:21.174Z","repository":{"id":217384973,"uuid":"743743880","full_name":"pcattori/ocaml-cheatsheet","owner":"pcattori","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-02T18:10:58.000Z","size":2,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-01T21:23:25.855Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pcattori.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-15T22:22:47.000Z","updated_at":"2024-11-15T16:13:38.000Z","dependencies_parsed_at":"2024-02-02T19:28:02.577Z","dependency_job_id":null,"html_url":"https://github.com/pcattori/ocaml-cheatsheet","commit_stats":null,"previous_names":["pcattori/ocaml-cheatsheet"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcattori%2Focaml-cheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcattori%2Focaml-cheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcattori%2Focaml-cheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcattori%2Focaml-cheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcattori","download_url":"https://codeload.github.com/pcattori/ocaml-cheatsheet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240037941,"owners_count":19738048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T19:11:02.353Z","updated_at":"2026-04-24T07:30:21.101Z","avatar_url":"https://github.com/pcattori.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ocaml cheatsheet\n\nNotes from when I went on [Dillon Mulroy's Twitch stream](https://www.twitch.tv/dmmulroy) to talk about [getting started with OCaml](https://www.youtube.com/watch?v=FtI5hxDcVKU).\n\n## learning\n\nThe official [\"Learn OCaml\"](https://ocaml.org/docs) docs are always improving, but here are some other resources I found invaluable when starting out.\n\n#### Tools \u0026 techniques\n\n👉 [Real World OCaml](https://dev.realworldocaml.org/)\n\n- [Command-line parsing](https://dev.realworldocaml.org/command-line-parsing.html)\n- [Error handling](https://dev.realworldocaml.org/error-handling.html)\n- [Maps and hash tables](https://dev.realworldocaml.org/maps-and-hashtables.html)\n- [Serialization](https://dev.realworldocaml.org/data-serialization.html)\n- [JSON](https://dev.realworldocaml.org/json.html)\n- [Testing](https://dev.realworldocaml.org/testing.html)\n\n#### Programming language design \u0026 theory\n\n👉 [OCaml Programming: Correct + Efficient + Beautiful](https://cs3110.github.io/textbook/cover.html#)\n\n- [Implementing an interpreter in OCaml](https://cs3110.github.io/textbook/chapters/interp/intro.html)\n- [The Curry-Howard Correspondence](https://cs3110.github.io/textbook/chapters/adv/curry-howard.html)\n\n## project setup\n\n```sh\ndune init proj \u003cname\u003e\ncd \u003cname\u003e\nopam switch create . --deps-only\n```\n\nMinimal `dune-project` for CLIs:\n\n```lisp\n(lang dune 3.11)\n\n(generate_opam_files true)\n\n(package\n (name \u003cname of your cli\u003e)\n (depends ocaml dune))\n```\n\n#### git\n\nInitialize a git repo:\n\n```sh\ngit init\n```\n\nThen add a `.gitignore`:\n\n```txt\n_build/\n_opam/\n```\n\n#### opam switch\n\nSetup `opam` to auto-enable the switch when entering the directory:\n\n```sh\nopam init --enable-shell-hook\n```\n\nOr do this every time:\n\n```sh\neval $(opam env)\n```\n\n#### dev dependencies\n\n```sh\nopam install ocaml-lsp-server odoc ocamlformat utop\n```\n\n## neovim\n\nDo not do the `rtp` thing that `opam` suggests.\nInstead, do this if using `lazy.nvim` as your package manager:\n\n```lua\n-- ~/.config/nvim/lua/plugins/ocaml.lua\n\nreturn {\n  {\n    \"nvim-treesitter/nvim-treesitter\",\n    opts = {\n      ensure_installed = { \"ocaml\", \"ocaml_interface\" },\n    },\n  },\n  {\n    \"neovim/nvim-lspconfig\",\n    opts = {\n      servers = {\n        -- use local lsp installed within project's opam switch\n        ocamllsp = { mason = false },\n      },\n    },\n  },\n}\n```\n\n[dmmulroy]: https://www.twitch.tv/dmmulroy\n[getting-started-with-ocaml]: https://www.youtube.com/watch?v=FtI5hxDcVKU\n[learn-ocaml]: https://ocaml.org/docs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcattori%2Focaml-cheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcattori%2Focaml-cheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcattori%2Focaml-cheatsheet/lists"}