Skip to content

Commit

Permalink
[sfh][2023] Day 1 (OCaml/Reason)
Browse files Browse the repository at this point in the history
  • Loading branch information
solomonhawk committed Dec 1, 2023
1 parent 3ad8924 commit ba42df4
Show file tree
Hide file tree
Showing 120 changed files with 6,700 additions and 0 deletions.
1 change: 1 addition & 0 deletions solomonhawk/2023/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
esy.lock/* linguist-generated
10 changes: 10 additions & 0 deletions solomonhawk/2023/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.merlin
.DS_Store
node_modules/
_build
_esy
_release
*.byte
*.native
*.install
inputs/*
12 changes: 12 additions & 0 deletions solomonhawk/2023/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"[dune]": {
"editor.formatOnSave": true
},
"[reason]": {
"editor.formatOnSave": true
},
"ocaml.sandbox": {
"kind": "esy",
"root": "${workspaceFolder:2023}"
}
}
52 changes: 52 additions & 0 deletions solomonhawk/2023/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# AOC Reason

## Install Deps

$ esy

This is an alias for `esy install` or `esy i`.

## Build

$ esy b

`b` is an alias for `esy build`.

## Run

$ esy x aoc

`x` is an alias for `esy exec`.

## Watch

$ npm run build:watch

## Test

$ npm run test
$ npm run test:watch

**Note**: Only one dune process can be run at a time (it locks the build directory), so you must stop the watch process before running tests.

## Notes/Questions

- [ ] Can `esy` be used with `asdf-ocaml` in a sensible way?
- [ ] `esy` has it's own project sandboxing (like `opam` switches, but project-specific by default)

## References

- https://www.chrisarmstrong.dev/posts/setting-up-a-new-reason-project
- https://mukulrathi.com/ocaml-tooling-dune/
- https://reasonml.github.io/en/try.html
- https://github.com/fangyi-zhou/advent-of-code-ocaml-starter/tree/main
- https://github.com/fangyi-zhou/advent-of-code/tree/main/2022
- https://github.com/DrearyLisper/aoc-2022
- https://ocaml.org/docs
- https://reasonml.github.io/docs/en/overview
- https://dune.readthedocs.io/en/stable/index.html
- https://esy.sh/docs/getting-started/
- https://github.com/janestreet/ppx_inline_test/tree/master
- https://discuss.ocaml.org/t/how-to-set-up-unit-testing-in-2023/12682/26
- https://discuss.ocaml.org/t/ocaml-stdlib-and-death-by-a-thousand-papercuts/9180/9
- https://c-cube.github.io/ocaml-containers/last/containers/index.html
20 changes: 20 additions & 0 deletions solomonhawk/2023/aoc.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
depends: [
"dune" {>= "3.11"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
4 changes: 4 additions & 0 deletions solomonhawk/2023/bin/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(executable
(name main)
(public_name aoc)
(libraries aoc))
5 changes: 5 additions & 0 deletions solomonhawk/2023/bin/main.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
open Aoc;

let () = {
Day1.run();
};
3 changes: 3 additions & 0 deletions solomonhawk/2023/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 3.11)
(name aoc)
(generate_opam_files true)
24 changes: 24 additions & 0 deletions solomonhawk/2023/esy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "aoc-2023",
"dependencies": {
"@opam/containers": "3.12",
"@opam/dune": ">= 3.8.0",
"@opam/reason": "*",
"ocaml": "5.1.4"
},
"devDependencies": {
"@opam/merlin": "*",
"@opam/ocaml-lsp-server": "*",
"@opam/ocamlformat": "*",
"@opam/ppx_assert": "*",
"@opam/ppx_compare": "v0.16.0",
"@opam/ppx_expect": "v0.16.0",
"@opam/ppx_inline_test": "*",
"@opam/ppx_sexp_conv": "v0.16.0",
"@opam/sexplib": "v0.16.0",
"@opam/utop": "*"
},
"esy": { "buildsInSource": "_build", "build": [ "dune build -p aoc" ] },
"scripts": { "build:watch": "dune build -w -p aoc" },
"installConfig": { "pnp": false }
}
3 changes: 3 additions & 0 deletions solomonhawk/2023/esy.lock/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions solomonhawk/2023/esy.lock/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ba42df4

Please sign in to comment.