mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Add blank lines around headings
See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md022
This commit is contained in:
parent
6229eb54ca
commit
e3071a22b0
7 changed files with 19 additions and 1 deletions
|
@ -1,5 +1,4 @@
|
|||
config:
|
||||
blanks-around-headings: false
|
||||
blanks-around-lists: false
|
||||
commands-show-output: false
|
||||
emphasis-style: false
|
||||
|
|
|
@ -113,6 +113,7 @@ sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
|||
```
|
||||
|
||||
### Zig
|
||||
|
||||
**version: 0.9.1**
|
||||
|
||||
For any OS, you can use [`zigup`](https://github.com/marler8997/zigup) to manage zig installations.
|
||||
|
@ -127,6 +128,7 @@ If you want to install it manually, you can also download Zig directly [here](ht
|
|||
> WINDOWS NOTE: when you unpack the Zig archive on windows, the result is nested in an extra directory. The instructions on the zig website will seem to not work. So, double-check that the path to zig executable does not include the same directory name twice.
|
||||
|
||||
### LLVM
|
||||
|
||||
**version: 13.0.x**
|
||||
|
||||
For macOS, you can install LLVM 13 using `brew install llvm@13` and then adding
|
||||
|
|
|
@ -21,6 +21,7 @@ cargo clippy --workspace --tests -- --deny warnings
|
|||
Execute `cargo fmt --all` to fix the formatting.
|
||||
|
||||
## Contribution Tips
|
||||
|
||||
- If you've never made a pull request on github before, [this](https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github-3/) will be a good place to start.
|
||||
- Create an issue if the purpose of a struct/field/type/function/... is not immediately clear from its name or nearby comments.
|
||||
- You can find good first issues [here](https://github.com/roc-lang/roc/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
|
||||
|
|
|
@ -1201,18 +1201,21 @@ and also `Num.cos 1` and have them all work as expected; the number literal `1`
|
|||
you can pass number literals to functions expecting even more constrained types, like `I32` or `F64`.
|
||||
|
||||
### Typed Number Literals
|
||||
|
||||
When writing a number literal in Roc you can specify the numeric type as a suffix of the literal.
|
||||
`1u8` specifies `1` as an unsigned 8-bit integer, `5i32` specifies `5` as a signed 32-bit integer, etc.
|
||||
The full list of possible suffixes includes:
|
||||
`i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `nat`, `f32`, `f64`, `dec`
|
||||
|
||||
### Hexadecimal Integer Literals
|
||||
|
||||
Integer literals can be written in hexadecimal form by prefixing with `0x` followed by hexadecimal characters.
|
||||
`0xFE` evaluates to decimal `254`
|
||||
The integer type can be specified as a suffix to the hexadecimal literal,
|
||||
so `0xC8u8` evaluates to decimal `200` as an unsigned 8-bit integer.
|
||||
|
||||
### Binary Integer Literals
|
||||
|
||||
Integer literals can be written in binary form by prefixing with `0b` followed by the 1's and 0's representing
|
||||
each bit. `0b0000_1000` evaluates to decimal `8`
|
||||
The integer type can be specified as a suffix to the binary literal,
|
||||
|
|
|
@ -61,23 +61,33 @@ In these builtin definitions you will need to allocate for and list the argument
|
|||
Since `List.repeat` is implemented entirely as low level functions, its `body` is a `RunLowLevel`, and the `op` is `LowLevel::ListRepeat`. Lets talk about `LowLevel` in the next section.
|
||||
|
||||
## Connecting the definition to the implementation
|
||||
|
||||
### module/src/low_level.rs
|
||||
|
||||
This `LowLevel` thing connects the builtin defined in this module to its implementation. It's referenced in `can/src/builtins.rs` and it is used in `gen/src/llvm/build.rs`.
|
||||
|
||||
## Bottom level LLVM values and functions
|
||||
|
||||
### gen/src/llvm/build.rs
|
||||
|
||||
This is where bottom-level functions that need to be written as LLVM are created. If the function leads to a tag thats a good sign it should not be written here in `build.rs`. If it's simple fundamental stuff like `INT_ADD` then it certainly should be written here.
|
||||
|
||||
## Letting the compiler know these functions exist
|
||||
|
||||
### builtins/src/std.rs
|
||||
|
||||
It's one thing to actually write these functions, it's _another_ thing to let the Roc compiler know they exist as part of the standard library. You have to tell the compiler "Hey, this function exists, and it has this type signature". That happens in `std.rs`.
|
||||
|
||||
## Specifying how we pass args to the function
|
||||
|
||||
### builtins/mono/src/borrow.rs
|
||||
|
||||
After we have all of this, we need to specify if the arguments we're passing are owned, borrowed or irrelevant. Towards the bottom of this file, add a new case for your builtin and specify each arg. Be sure to read the comment, as it explains this in more detail.
|
||||
|
||||
## Testing it
|
||||
|
||||
### solve/tests/solve_expr.rs
|
||||
|
||||
To make sure that Roc is properly inferring the type of the new builtin, add a test to this file similar to:
|
||||
|
||||
```
|
||||
|
@ -97,6 +107,7 @@ fn atan() {
|
|||
But replace `Num.atan` and the type signature with the new builtin.
|
||||
|
||||
### test_gen/test/*.rs
|
||||
|
||||
In this directory, there are a couple files like `gen_num.rs`, `gen_str.rs`, etc. For the `Str` module builtins, put the test in `gen_str.rs`, etc. Find the one for the new builtin, and add a test like:
|
||||
|
||||
```
|
||||
|
|
|
@ -65,6 +65,7 @@ e.g. you have a test `calculate_sum_test` that only uses the function `add`, whe
|
|||
- VR debugging: render massive curved screen with rectangle showing code (and expression values) for every function in call stack.
|
||||
|
||||
### Testing
|
||||
|
||||
- [Wallaby.js](https://wallabyjs.com/) could serve as inspiration for live gutters showing tested / untested / passing / failing code based on tests, combined with time travel debugging (inline runtime values / inline error reports / inline code coverage); could be useful for debugging as well
|
||||
|
||||
### Cool regular editors
|
||||
|
|
|
@ -38,6 +38,7 @@ python3 -m http.server
|
|||
```
|
||||
|
||||
### 3. Open your browser
|
||||
|
||||
You should be able to find the Roc REPL at http://127.0.0.1:8000/repl (or whatever port your web server mentioned when it started up.)
|
||||
|
||||
**Warning:** This is work in progress! Not all language features are implemented yet, error messages don't look nice yet, up/down arrows don't work for history, etc.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue