Add OCaml

This commit is contained in:
Mylloon 2023-09-19 16:07:18 +02:00
parent 07349b3c15
commit 6cd4269eee
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
11 changed files with 59 additions and 0 deletions

View file

@ -2,6 +2,7 @@
- [C](#c)
- [C++](#c-1)
- [OCaml](#ocaml)
- [Typescript](#typescript)
## C
@ -28,6 +29,21 @@ Copy and paste [`cpp/`](./cpp/) directory, and you should be good to go!
> Note that in headers, the syntax is `PROJECTNAME_FILENAME_HPP`
## OCaml
Copy and paste [`ocaml/`](./ocaml/) directory, and you should be good to go!
- Remember to change values in the [`dune-project`](./ocaml/dune-project).
- **Run `dune exec example` to run the program.**
- **Run `dune runtest` to run tests.**
> Example of custom repository source:
>
> ```dune
> (source
> (uri https://dev.example.com/project.git))
> ```
## Typescript
Copy and paste [`typescript/`](./typescript/) directory, and you should be good to go!

1
ocaml/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/_build

1
ocaml/.ocamlformat Normal file
View file

@ -0,0 +1 @@
profile = janestreet

4
ocaml/bin/dune Normal file
View file

@ -0,0 +1,4 @@
(executable
(public_name example)
(name main)
(libraries example))

3
ocaml/bin/main.ml Normal file
View file

@ -0,0 +1,3 @@
open Example.Hello
let () = print_endline hello_world

24
ocaml/dune-project Normal file
View file

@ -0,0 +1,24 @@
(lang dune 3.10)
(name example)
(generate_opam_files true)
(source
(github username/reponame))
(authors "YOU")
(maintainers "YOU")
(license AGPL-3.0-or-later)
(package
(name example)
(synopsis "A short synopsis")
(description "A longer description")
(depends ocaml dune)
(tags
(topics "to describe" your project)))
; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project

0
ocaml/example.opam Normal file
View file

3
ocaml/lib/dune Normal file
View file

@ -0,0 +1,3 @@
(library
(name example)
(modules hello))

1
ocaml/lib/hello.ml Normal file
View file

@ -0,0 +1 @@
let hello_world = "Hello, world!"

3
ocaml/test/dune Normal file
View file

@ -0,0 +1,3 @@
(test
(name test)
(libraries example))

3
ocaml/test/test.ml Normal file
View file

@ -0,0 +1,3 @@
open Example.Hello
let () = assert ("Hello, world!" = hello_world)