@@ -7,9 +7,10 @@ layout: standard
77 Added in v5.0.0-rc.1
88</p >
99
10- ## Erlang/OTP Version
10+ ## Prerequisites
1111
12- Fable targets Erlang/OTP 25 or higher.
12+ - [ Erlang/OTP] ( https://www.erlang.org/downloads ) 25 or higher
13+ - [ rebar3] ( https://rebar3.org/ ) (the standard Erlang build tool)
1314
1415## Architecture
1516
@@ -27,7 +28,7 @@ Erlang AST
2728.erl source files
2829```
2930
30- The generated ` .erl ` files are standard Erlang that can be compiled with ` erlc ` and run on the BEAM VM.
31+ The generated ` .erl ` files are standard Erlang that can be compiled with rebar3 and run on the BEAM VM.
3132
3233## Compiling to Erlang
3334
@@ -43,42 +44,52 @@ dotnet fable --lang beam --outDir /path/to/output
4344
4445## Output Structure
4546
46- The output directory will contain:
47+ Fable automatically generates a complete [ rebar3 ] ( https://rebar3.org/ ) project scaffold alongside the compiled ` .erl ` files. The output directory will contain:
4748
4849``` text
4950output/
50- program.erl # Your compiled F# modules
51+ rebar.config # rebar3 project config (auto-generated)
52+ src/
53+ program.erl # Your compiled F# modules
54+ my_project.app.src # OTP application resource file
5155 fable_modules/
5256 fable-library-beam/
53- fable_list.erl # F# List runtime
54- fable_map.erl # F# Map runtime
55- fable_string.erl # String utilities
56- fable_seq.erl # Seq/IEnumerable support
57- ... # Other runtime modules
57+ rebar.config # Per-dependency rebar3 config
58+ src/
59+ fable_library_beam.app.src # OTP app resource for the library
60+ fable_list.erl # F# List runtime
61+ fable_map.erl # F# Map runtime
62+ fable_string.erl # String utilities
63+ fable_seq.erl # Seq/IEnumerable support
64+ ... # Other runtime modules
5865```
5966
60- ## Compiling Erlang
67+ ### Rebar3 Scaffold Details
6168
62- After Fable generates ` .erl ` files, compile them with ` erlc ` :
69+ — if you create your own ` rebar.config ` (without the Fable marker), it will be left untouched (a warning is emitted)
70+ — project and dependency names are normalized to valid OTP application names (e.g., ` Fable.Logging.0.10.0 ` → ` fable_logging ` , ` fable-library-beam ` → ` fable_library_beam ` )
71+ — the generated ` rebar.config ` uses ` {project_app_dirs, [".", "fable_modules/*"]} ` so rebar3 treats each NuGet dependency as a sub-application
6372
64- ``` bash
65- # Compile the runtime library
66- erlc -o output/fable_modules/fable-library-beam output/fable_modules/fable-library-beam/ * .erl
73+ ## Compiling with rebar3
74+
75+ After Fable generates the scaffold, compile everything with rebar3:
6776
68- # Compile your project files
69- erlc -pa output/fable_modules/fable-library-beam -o output output/ * .erl
77+ ``` bash
78+ rebar3 compile
7079```
7180
81+ This compiles all ` .erl ` files (your project and all dependencies) and places ` .beam ` files in ` _build/default/lib/*/ebin/ ` .
82+
7283## Running Erlang Code
7384
7485Run your compiled module using the Erlang shell:
7586
7687``` bash
77- erl -pa output -pa output/fable_modules/fable-library-beam \
78- -noshell - eval ' program:main(), halt().'
88+ erl -noshell -pa _build/default/lib/ * /ebin \
89+ -eval ' program:main(), halt().'
7990```
8091
81- The ` -pa ` flag adds directories to the code path so Erlang can find both your modules and the Fable runtime library.
92+ The ` -pa ` flag adds the rebar3 output directories to the code path so Erlang can find both your modules and the Fable runtime library.
8293
8394## Module Naming
8495
0 commit comments