diff options
| author | DJ O'Leary <dijitol@proton.me> | 2025-11-19 14:21:01 +0100 |
|---|---|---|
| committer | DJ O'Leary <dijitol@proton.me> | 2025-11-19 14:21:01 +0100 |
| commit | 9fe544d9f7acc493fbd1bd76facaa7bfe435ca37 (patch) | |
| tree | 9614e336eb4836ea715c153fcfb319922a3a35f1 /2025/ocaml | |
| parent | def813adf8ca5bf6f42edf9489ed07f32795355b (diff) | |
chore: clone ocaml_template for 2025
Diffstat (limited to '2025/ocaml')
33 files changed, 641 insertions, 0 deletions
diff --git a/2025/ocaml/.editorconfig b/2025/ocaml/.editorconfig new file mode 100644 index 0000000..64b41ca --- /dev/null +++ b/2025/ocaml/.editorconfig @@ -0,0 +1,27 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space + +[*.{ml,mli}] +indent_style = space +indent_size = 2 +tab_width = 2 + +[*.{opam,dune,install,sexp,conf,in}] +indent_style = space +indent_size = 4 + +[*.{md}] +indent_style = tab +trim_trailing_whitespace = true + +[*.{nix}] +indent_style = space +indent_size = 2 +insert_final_newline = false +trim_trailing_whitespace = true diff --git a/2025/ocaml/.envrc b/2025/ocaml/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/2025/ocaml/.envrc @@ -0,0 +1 @@ +use flake diff --git a/2025/ocaml/.gitattributes b/2025/ocaml/.gitattributes new file mode 100644 index 0000000..1bc2e72 --- /dev/null +++ b/2025/ocaml/.gitattributes @@ -0,0 +1,7 @@ +# http://git-scm.com/docs/gitattributes#_end_of_line_conversion +* text=auto +.* text eol=lf + +flake.lock linguist-generated +ocaml_template.install linguist-generated +ocaml_template.opam linguist-generated diff --git a/2025/ocaml/.gitignore b/2025/ocaml/.gitignore new file mode 100644 index 0000000..cb02e52 --- /dev/null +++ b/2025/ocaml/.gitignore @@ -0,0 +1,42 @@ +*.annot +*.cmo +*.cma +*.cmi +*.a +*.o +*.cmx +*.cmxs +*.cmxa + +# Files containing detailed information about the compilation (generated +# by `ocamlc`/`ocamlopt` when invoked using the option `-bin-annot`). +# These files are typically useful for code inspection tools +# (e.g. Merlin). +*.cmt +*.cmti + +# ocamlbuild and Dune default working directory +_build/ + +# ocamlbuild targets +*.byte +*.native + +# oasis generated files +setup.data +setup.log + +# Merlin configuring file for Vim and Emacs +.merlin + +# Dune generated files +*.install + +# Local OPAM switch +_opam/ + +# DirEnv cache +.direnv/ + +# Taskfile cache +.task/ diff --git a/2025/ocaml/.ocamlformat b/2025/ocaml/.ocamlformat new file mode 100644 index 0000000..c7c5d06 --- /dev/null +++ b/2025/ocaml/.ocamlformat @@ -0,0 +1,3 @@ +profile = default +version = 0.27.0 + diff --git a/2025/ocaml/CODEOWNERS b/2025/ocaml/CODEOWNERS new file mode 100644 index 0000000..66c50a2 --- /dev/null +++ b/2025/ocaml/CODEOWNERS @@ -0,0 +1 @@ +* @djoleary diff --git a/2025/ocaml/CONTRIBUTING.md b/2025/ocaml/CONTRIBUTING.md new file mode 100644 index 0000000..832b94b --- /dev/null +++ b/2025/ocaml/CONTRIBUTING.md @@ -0,0 +1,5 @@ +# Contributing + +## Commit Messages + +We use conventional commits for all commit messages. See <https://www.conventionalcommits.org/en/v1.0.0/> diff --git a/2025/ocaml/LICENSE b/2025/ocaml/LICENSE new file mode 100644 index 0000000..1e9858b --- /dev/null +++ b/2025/ocaml/LICENSE @@ -0,0 +1,25 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <https://unlicense.org> + diff --git a/2025/ocaml/README.md b/2025/ocaml/README.md new file mode 100644 index 0000000..2500c9e --- /dev/null +++ b/2025/ocaml/README.md @@ -0,0 +1,54 @@ +# OCaml Template + +This is a template for OCaml projects. + +## Quick Start + +1. Fork this repository +2. Rename the repository to your project name +3. Replace all instances of `ocaml_template` with your project name, both in files and filenames themselves. + +## Project Structure + +```txt +. +├── _build # build outputs +├── bin # program entry points +├── docs # documentation +├── lib # public modules +├── test # tests +├── .editorconfig +├── .envrc +├── .gitignore +├── .ocamlformat # ocamlformat configuration +├── CODEOWNERS +├── CONTRIBUTING.md +├── LICENSE +├── README.md +├── Taskfile.yml # task runner configuration similar to make +├── dune-project # dune project configuration +├── flake.lock +├── flake.nix # nix flake configuration +├── ocaml_template.install # autogenerated install script +└── ocaml_template.opam # autogenerated project description +``` + +## Tools + +- [task](https://taskfile.dev/) +- [dune](https://dune.build/) +- [opam](https://opam.ocaml.org/) +- [ocamlformat](https://ocaml.org/p/ocamlformat/latest/doc/index.html) +- [odoc](https://ocaml.github.io/odoc/odoc/index.html) +- [alchotest](https://github.com/mirage/alcotest) +- [bisect_ppx](https://github.com/aantron/bisect_ppx) +- [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) +- [earlybird](https://github.com/ocaml-lsp/earlybird) +- [findlib](https://github.com/ocaml/ocamlfind) +- [menhir](https://github.com/ocaml-menhir/menhir) +- [re2](https://github.com/janestreet/re2) +- [fmt](https://erratique.ch/software/fmt) + +## License + +This project is licensed under the [Unlicense](https://unlicense.org/). diff --git a/2025/ocaml/Taskfile.yml b/2025/ocaml/Taskfile.yml new file mode 100644 index 0000000..b562b3a --- /dev/null +++ b/2025/ocaml/Taskfile.yml @@ -0,0 +1,67 @@ +# https://taskfile.dev +version: "3" + +tasks: + + default: + desc: Prints this message + cmds: + - cmd: task --list-all + + docs: + desc: Builds documentation using ocamldoc + preconditions: + - command -v ocamldoc + cmds: + - cmd: ocamldoc -html -d docs bin/main.ml + silent: true + + test: + desc: Runs the tests in the 'tests' directory + ignore_error: true + env: + OUNIT_CI: true + preconditions: + - command -v dune + deps: + - task: build + cmds: + - cmd: dune runtest {{.CLI_ARGS}} + + test:watch: + desc: Continuously runs the tests in the 'tests' directory + ignore_error: true + sources: + - lib/**/*.ml + - test/**/*.ml + env: + OUNIT_CI: true + preconditions: + - command -v dune + deps: + - task: build + cmds: + - cmd: dune runtest --watch {{.CLI_ARGS}} + + build: + desc: Builds the project + preconditions: + - command -v dune + cmds: + - cmd: dune build + + build:release: + desc: Builds a release version the project + preconditions: + - command -v dune + cmds: + - cmd: dune build --release + + run: + desc: Runs the project + preconditions: + - command -v dune + deps: + - task: build + cmds: + - cmd: dune exec -- ./bin/main.exe {{.CLI_ARGS}} diff --git a/2025/ocaml/bin/dune b/2025/ocaml/bin/dune new file mode 100644 index 0000000..4768523 --- /dev/null +++ b/2025/ocaml/bin/dune @@ -0,0 +1,4 @@ +(executable + (public_name ocaml_template) + (name main) + (libraries ocaml_template)) diff --git a/2025/ocaml/bin/main.ml b/2025/ocaml/bin/main.ml new file mode 100644 index 0000000..7bf6048 --- /dev/null +++ b/2025/ocaml/bin/main.ml @@ -0,0 +1 @@ +let () = print_endline "Hello, World!" diff --git a/2025/ocaml/docs/Main.html b/2025/ocaml/docs/Main.html new file mode 100644 index 0000000..11d7257 --- /dev/null +++ b/2025/ocaml/docs/Main.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link rel="Up" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Main</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Module <a href="type_Main.html">Main</a></h1> + +<pre><span id="MODULEMain"><span class="keyword">module</span> Main</span>: <code class="code">sig</code> <a href="Main.html">..</a> <code class="code">end</code></pre><hr width="100%"> +</body></html> diff --git a/2025/ocaml/docs/index.html b/2025/ocaml/docs/index.html new file mode 100644 index 0000000..f536f1a --- /dev/null +++ b/2025/ocaml/docs/index.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title></title> +</head> +<body> +<div class = "index-list"> +<ul class="indexlist"> +<li><a href="index_modules.html">Index of modules</a></li> +</ul> +</div> + +<table class="indextable module-list"> +<tr><td class="module"><a href="Main.html">Main</a></td><td></td></tr> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_attributes.html b/2025/ocaml/docs/index_attributes.html new file mode 100644 index 0000000..3450f40 --- /dev/null +++ b/2025/ocaml/docs/index_attributes.html @@ -0,0 +1,17 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of class attributes</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of class attributes</h1> +<table> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_class_types.html b/2025/ocaml/docs/index_class_types.html new file mode 100644 index 0000000..be3ecc7 --- /dev/null +++ b/2025/ocaml/docs/index_class_types.html @@ -0,0 +1,17 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of class types</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of class types</h1> +<table> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_classes.html b/2025/ocaml/docs/index_classes.html new file mode 100644 index 0000000..08c083b --- /dev/null +++ b/2025/ocaml/docs/index_classes.html @@ -0,0 +1,17 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of classes</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of classes</h1> +<table> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_exceptions.html b/2025/ocaml/docs/index_exceptions.html new file mode 100644 index 0000000..0767720 --- /dev/null +++ b/2025/ocaml/docs/index_exceptions.html @@ -0,0 +1,17 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of exceptions</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of exceptions</h1> +<table> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_extensions.html b/2025/ocaml/docs/index_extensions.html new file mode 100644 index 0000000..38625df --- /dev/null +++ b/2025/ocaml/docs/index_extensions.html @@ -0,0 +1,17 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of extensions</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of extensions</h1> +<table> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_methods.html b/2025/ocaml/docs/index_methods.html new file mode 100644 index 0000000..7debe46 --- /dev/null +++ b/2025/ocaml/docs/index_methods.html @@ -0,0 +1,17 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of class methods</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of class methods</h1> +<table> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_module_types.html b/2025/ocaml/docs/index_module_types.html new file mode 100644 index 0000000..0b75a38 --- /dev/null +++ b/2025/ocaml/docs/index_module_types.html @@ -0,0 +1,17 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of module types</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of module types</h1> +<table> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_modules.html b/2025/ocaml/docs/index_modules.html new file mode 100644 index 0000000..b6588a3 --- /dev/null +++ b/2025/ocaml/docs/index_modules.html @@ -0,0 +1,20 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of modules</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of modules</h1> +<table> +<tr><td align="left"><div>M</div></td></tr> +<tr><td><a href="Main.html">Main</a> </td> +<td></td></tr> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_types.html b/2025/ocaml/docs/index_types.html new file mode 100644 index 0000000..61efcda --- /dev/null +++ b/2025/ocaml/docs/index_types.html @@ -0,0 +1,17 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of types</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of types</h1> +<table> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/index_values.html b/2025/ocaml/docs/index_values.html new file mode 100644 index 0000000..fc7294b --- /dev/null +++ b/2025/ocaml/docs/index_values.html @@ -0,0 +1,17 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Index of values</title> +</head> +<body> +<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> + </div> +<h1>Index of values</h1> +<table> +</table> +</body> +</html> diff --git a/2025/ocaml/docs/style.css b/2025/ocaml/docs/style.css new file mode 100644 index 0000000..259bd49 --- /dev/null +++ b/2025/ocaml/docs/style.css @@ -0,0 +1,43 @@ +.keyword { font-weight : bold ; color : Red } +.keywordsign { color : #C04600 } +.comment { color : Green } +.constructor { color : Blue } +.type { color : #5C6585 } +.string { color : Maroon } +.warning { color : Red ; font-weight : bold } +.info { margin-left : 3em; margin-right: 3em } +.param_info { margin-top: 4px; margin-left : 3em; margin-right : 3em } +.code { color : #465F91 ; } +.typetable { border-style : hidden } +.paramstable { border-style : hidden ; padding: 5pt 5pt} +tr { background-color : White } +td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;} +div.sig_block {margin-left: 2em} +*:target { background: yellow; } +body {font: 13px sans-serif; color: black; text-align: left; padding: 5px; margin: 0} +h1 { font-size : 20pt ; text-align: center; } +h2 { font-size : 20pt ; text-align: center; } +h3 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90BDFF ;padding: 2px; } +h4 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90DDFF ;padding: 2px; } +h5 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90EDFF ;padding: 2px; } +h6 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90FDFF ;padding: 2px; } +div.h7 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90BDFF ; padding: 2px; } +div.h8 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #E0FFFF ; padding: 2px; } +div.h9 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #F0FFFF ; padding: 2px; } +div.h10 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #FFFFFF ; padding: 2px; } +a {color: #416DFF; text-decoration: none} +a:hover {background-color: #ddd; text-decoration: underline} +pre { margin-bottom: 4px; font-family: monospace; } +pre.verbatim, pre.codepre { } +.indextable {border: 1px #ddd solid; border-collapse: collapse} +.indextable td, .indextable th {border: 1px #ddd solid; min-width: 80px} +.indextable td.module {background-color: #eee ; padding-left: 2px; padding-right: 2px} +.indextable td.module a {color: #4E6272; text-decoration: none; display: block; width: 100%} +.indextable td.module a:hover {text-decoration: underline; background-color: transparent} +.deprecated {color: #888; font-style: italic} +.indextable tr td div.info { margin-left: 2px; margin-right: 2px } +ul.indexlist { margin-left: 0; padding-left: 0;} +ul.indexlist li { list-style-type: none ; margin-left: 0; padding-left: 0; } +ul.info-attributes {list-style: none; margin: 0; padding: 0; } +div.info > p:first-child { margin-top:0; } +div.info-desc > p:first-child { margin-top:0; margin-bottom:0; }
\ No newline at end of file diff --git a/2025/ocaml/docs/type_Main.html b/2025/ocaml/docs/type_Main.html new file mode 100644 index 0000000..43bb69c --- /dev/null +++ b/2025/ocaml/docs/type_Main.html @@ -0,0 +1,10 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="Start" href="index.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Main" rel="Chapter" href="Main.html"><title>Main</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span> <span class="keyword">end</span></code></body></html> diff --git a/2025/ocaml/dune-project b/2025/ocaml/dune-project new file mode 100644 index 0000000..5e5d724 --- /dev/null +++ b/2025/ocaml/dune-project @@ -0,0 +1,26 @@ +(lang dune 3.20) + +(name ocaml_template) + +(generate_opam_files true) + +(source + (github djoleary/ocaml_template)) + +(authors "DJ O'Leary <dijitol@proton.me>") + +(maintainers "DJ O'Leary <dijitol@proton.me>") + +(license Unlicense) + +(documentation https://github.com/djoleary/ocaml_template/docs/index.html) + +(package + (name ocaml_template) + (synopsis "A template for OCaml projects") + (description "A template for OCaml projects using Dune") + (depends ocaml (alcotest :with-test)) + (tags + ("project template"))) + +; See the complete stanza docs at https://dune.readthedocs.io/en/stable/reference/dune-project/index.html diff --git a/2025/ocaml/flake.lock b/2025/ocaml/flake.lock new file mode 100644 index 0000000..3baeb69 --- /dev/null +++ b/2025/ocaml/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1763421233, + "narHash": "sha256-Stk9ZYRkGrnnpyJ4eqt9eQtdFWRRIvMxpNRf4sIegnw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "89c2b2330e733d6cdb5eae7b899326930c2c0648", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/2025/ocaml/flake.nix b/2025/ocaml/flake.nix new file mode 100644 index 0000000..9f27e56 --- /dev/null +++ b/2025/ocaml/flake.nix @@ -0,0 +1,47 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = + { nixpkgs, ... }: + let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + in + { + devShells.x86_64-linux.default = + let + ocamlPackages = with pkgs.ocaml-ng.ocamlPackages_5_2; [ + ocaml + + dune_3 # build system + + pkgs.opam # package manager + findlib # library manager + + ocaml-lsp # language server + earlybird # debug adapter + ocamlformat # formatter + + utop # REPL + + alcotest # unit test framework + bisect_ppx # test coverage + + odoc # documentation generator + + menhir # parser generator library + janeStreet.re2 # regular expression library + fmt # pretty printing library + cmdliner # command line library + ]; + sysTools = with pkgs; [ + go-task + gh + ]; + in + pkgs.mkShell { + buildInputs = ocamlPackages ++ sysTools; + }; + }; +}
\ No newline at end of file diff --git a/2025/ocaml/lib/dune b/2025/ocaml/lib/dune new file mode 100644 index 0000000..99d3a78 --- /dev/null +++ b/2025/ocaml/lib/dune @@ -0,0 +1,2 @@ +(library + (name ocaml_template)) diff --git a/2025/ocaml/ocaml_template.opam b/2025/ocaml/ocaml_template.opam new file mode 100644 index 0000000..cfd03c4 --- /dev/null +++ b/2025/ocaml/ocaml_template.opam @@ -0,0 +1,33 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "A template for OCaml projects" +description: "A template for OCaml projects using Dune" +maintainer: ["DJ O'Leary <dijitol@proton.me>"] +authors: ["DJ O'Leary <dijitol@proton.me>"] +license: "Unlicense" +tags: ["project template"] +homepage: "https://github.com/djoleary/ocaml_template" +doc: "https://github.com/djoleary/ocaml_template/docs/index.html" +bug-reports: "https://github.com/djoleary/ocaml_template/issues" +depends: [ + "dune" {>= "3.20"} + "ocaml" + "alcotest" {with-test} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/djoleary/ocaml_template.git" +x-maintenance-intent: ["(latest)"] diff --git a/2025/ocaml/test/dune b/2025/ocaml/test/dune new file mode 100644 index 0000000..e630fdd --- /dev/null +++ b/2025/ocaml/test/dune @@ -0,0 +1,3 @@ +(test + (libraries alcotest) + (name test_ocaml_template)) diff --git a/2025/ocaml/test/test_ocaml_template.ml b/2025/ocaml/test/test_ocaml_template.ml new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/2025/ocaml/test/test_ocaml_template.ml |
