You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/installation.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ title: Installation
5
5
This page is a detailed explanation on how to install Reason with [opam](https://opam.ocaml.org/), both manually and using a template. There are other options available, such as [esy](https://esy.sh), but we recommend using opam for the best experience. Check the [esy installation page](installation-esy.md) if you want to use esy instead.
6
6
7
7
### System requirements
8
+
8
9
- macOS and Linux are supported natively
9
10
- Windows is supported via WSL (https://ocaml.org/docs/ocaml-on-windows)
10
11
@@ -53,7 +54,7 @@ For a comprehensive guide on how to create an opam switch, refer to the followin
53
54
opam install reason
54
55
```
55
56
56
-
Once the instalation of the [`reason`](https://opam.ocaml.org/packages/reason) package is done you will have available the following tools `refmt` and `rtop` and there's no configuration change to enable the build system (dune) to build your code.
57
+
Once the installation of the [`reason`](https://opam.ocaml.org/packages/reason) package is done you will have available the following tools `refmt` and `rtop` and there's no configuration change to enable the build system (dune) to build your code.
57
58
58
59
Make sure you have installed the latest version of `refmt` and `rtop` by running the following command:
59
60
@@ -74,24 +75,37 @@ opam install dune
74
75
To wrap up the installation process, let's create a simple hello world project. With the basic setup done:
75
76
76
77
Create a file `hello.re` with the following content:
78
+
77
79
```
78
80
print_endline("Hello world!");
79
81
```
80
82
83
+
Create a file `dune-project` with the following content (check [dune.build](https://dune.build/) for latest version):
84
+
85
+
```
86
+
(lang dune 3.6)
87
+
```
88
+
89
+
Create an empty file `hello.opam`
90
+
81
91
Create a file `dune` with the following content:
92
+
82
93
```
83
94
(executable
84
95
(name hello)
85
96
(public_name hello))
86
97
```
98
+
87
99
> Note: dune uniformly uses the .exe extension to build native executables, even on Unix where programs don’t usually have a .exe extension.
88
100
89
101
The `executable` stanza is used to define executables and the `name` field is used to specify the name of the executable (Can run with `dune exec src/hello.exe`). The `public_name` field is used to specify the name of the executable when it is installed and allows you to run the executable with `hello` directly: `dune exec hello`.
90
102
91
103
Run the project (this will compile the project and run the executable):
0 commit comments