mirror of
https://github.com/jbranchaud/til
synced 2026-01-06 16:48:01 +00:00
Add Compile Reason To Native With Dune as a reasonml til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||||
|
|
||||||
_710 TILs and counting..._
|
_711 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -511,6 +511,7 @@ _710 TILs and counting..._
|
|||||||
|
|
||||||
- [Break Out Of A While Loop](reason/break-out-of-a-while-loop.md)
|
- [Break Out Of A While Loop](reason/break-out-of-a-while-loop.md)
|
||||||
- [Create A Stream From An Array](reason/create-a-stream-from-an-array.md)
|
- [Create A Stream From An Array](reason/create-a-stream-from-an-array.md)
|
||||||
|
- [Compile Reason To Native With Dune](reason/compile-reason-to-native-with-dune.md)
|
||||||
- [Data Structures With Self-Referential Types](reason/data-structures-with-self-referential-types.md)
|
- [Data Structures With Self-Referential Types](reason/data-structures-with-self-referential-types.md)
|
||||||
- [Defining Variants With Constructor Arguments](reason/defining-variants-with-constructor-arguments.md)
|
- [Defining Variants With Constructor Arguments](reason/defining-variants-with-constructor-arguments.md)
|
||||||
- [Dynamically Create A Printf String Format](reason/dynamically-create-a-printf-string-format.md)
|
- [Dynamically Create A Printf String Format](reason/dynamically-create-a-printf-string-format.md)
|
||||||
|
|||||||
28
reason/compile-reason-to-native-with-dune.md
Normal file
28
reason/compile-reason-to-native-with-dune.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Compile Reason To Native With Dune
|
||||||
|
|
||||||
|
[Dune](https://github.com/ocaml/dune) is "a composable build system for
|
||||||
|
OCaml" with out-of-the-box support for ReasonML. Dune can be used for a lot
|
||||||
|
of things, but in simplest terms it can be used to compile ReasonML programs
|
||||||
|
into native executables.
|
||||||
|
|
||||||
|
Considering the following ReasonML program.
|
||||||
|
|
||||||
|
```reason
|
||||||
|
/* hello_reason.re */
|
||||||
|
print_endline("Hello, Reason!")
|
||||||
|
```
|
||||||
|
|
||||||
|
We can then create the following Dune build file.
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
/* dune */
|
||||||
|
(executable
|
||||||
|
(name hello_reason))
|
||||||
|
```
|
||||||
|
|
||||||
|
If we then run `dune build hello_reason.exe`, then Dune will compile the
|
||||||
|
`hello_reason.re` into a `hello_reason.exe` executable that can be found in
|
||||||
|
`build/default`. Run it and see the output.
|
||||||
|
|
||||||
|
Read more in the [Quickstart
|
||||||
|
guide](https://dune.readthedocs.io/en/latest/quick-start.html).
|
||||||
Reference in New Issue
Block a user