Add blank lines around fenced code blocks

See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md031
This commit is contained in:
Jan Van Bruggen 2022-09-07 22:05:37 -06:00
parent 0ec886513f
commit 6229eb54ca
No known key found for this signature in database
GPG key ID: FE2A4E38E0FA6134
10 changed files with 44 additions and 1 deletions

View file

@ -1,5 +1,4 @@
config:
blanks-around-fences: false
blanks-around-headings: false
blanks-around-lists: false
commands-show-output: false

View file

@ -16,20 +16,25 @@ If you are running ArchLinux or a derivative like Manjaro, you'll need to run `s
Install nix (not necessary on NixOS):
- If you are using WSL (Windows subsystem for Linux):
```
sh <(curl -L https://nixos.org/nix/install) --no-daemon
```
- For everything else:
```
sh <(curl -L https://nixos.org/nix/install) --daemon
```
Open a new terminal and install nixFlakes in your environment:
```
nix-env -iA nixpkgs.nixFlakes
```
Edit either `~/.config/nix/nix.conf` or `/etc/nix/nix.conf` and add:
```
experimental-features = nix-command flakes
```
@ -40,9 +45,11 @@ If you don't know how to do this, restarting your computer will also do the job.
#### Usage
Now with nix set up, you just need to run one command from the roc project root directory:
```
nix develop
```
You should be in a shell with everything needed to build already installed.
Use `cargo run help` to see all subcommands.
To use the `repl` subcommand, execute `cargo run repl`.
@ -61,6 +68,7 @@ The editor is a :construction:WIP:construction: and not ready yet to replace you
`cargo run edit` should work on NixOS and MacOS. If you use Linux x86_64, follow the instructions below.
If you're not already in a nix shell, execute `nix develop` at the the root of the repo folder and then execute:
```
nixVulkanIntel cargo run edit
```
@ -125,11 +133,13 @@ For macOS, you can install LLVM 13 using `brew install llvm@13` and then adding
`$(brew --prefix llvm@13)/bin` to your `PATH`. You can confirm this worked by
running `llc --version` - it should mention "LLVM version 13.0.0" at the top.
You may also need to manually specify a prefix env var like so:
```
export LLVM_SYS_130_PREFIX=/usr/local/opt/llvm@13
```
For Ubuntu and Debian:
```
sudo apt -y install lsb-release software-properties-common gnupg
wget https://apt.llvm.org/llvm.sh
@ -164,10 +174,12 @@ On Ubuntu, running `sudo apt install pkg-config cmake libx11-dev` fixed this.
If you encounter `cannot find -lz` run `sudo apt install zlib1g-dev`.
If you encounter:
```
error: No suitable version of LLVM was found system-wide or pointed
to by LLVM_SYS_130_PREFIX.
```
Add `export LLVM_SYS_130_PREFIX=/usr/lib/llvm-13` to your `~/.bashrc` or equivalent file for your shell.
### LLVM installation on macOS
@ -191,11 +203,14 @@ The official LLVM pre-built binaries for Windows lack features that roc needs. I
1. [Download 7-zip](https://www.7-zip.org/) to be able to extract this archive.
1. Extract the 7z file to where you want to permanently keep the folder. We recommend you pick a path without any spaces in it.
1. In powershell, set the `LLVM_SYS_130_PREFIX` environment variable (check [here](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.2#saving-environment-variables-with-the-system-control-panel) to make this a permanent environment variable):
```
<# ! Replace YOUR_USERNAME ! #>
$env:LLVM_SYS_130_PREFIX = 'C:\Users\YOUR_USERNAME\Downloads\LLVM-13.0.0-win64'
```
1. add the LLVM bin to the path to prevent issue #3952:
```
<# ! Replace YOUR_USERNAME ! #>
[Environment]::SetEnvironmentVariable(

View file

@ -11,11 +11,13 @@ Check [Building from source](BUILDING_FROM_SOURCE.md) for instructions.
## Running Tests
Most contributors execute the following commands befor pushing their code:
```
cargo test
cargo fmt --all -- --check
cargo clippy --workspace --tests -- --deny warnings
```
Execute `cargo fmt --all` to fix the formatting.
## Contribution Tips
@ -30,6 +32,7 @@ Execute `cargo fmt --all` to fix the formatting.
2. [Make a key to sign your commits.](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key).
3. [Configure git to use your key.](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key)
4. Make git sign your commits automatically:
```
git config --global commit.gpgsign true
```

View file

@ -701,6 +701,7 @@ in the list returns `True`:
List.any [1, 2, 3] Num.isOdd
# returns True because 1 and 3 are odd
```
```coffee
List.any [1, 2, 3] Num.isNegative
# returns False because none of these is negative
@ -712,6 +713,7 @@ There's also `List.all` which only returns `True` if all the elements in the lis
List.all [1, 2, 3] Num.isOdd
# returns False because 2 is not odd
```
```coffee
List.all [1, 2, 3] Num.isPositive
# returns True because all of these are positive
@ -791,6 +793,7 @@ For example, what do each of these return?
```coffee
List.get ["a", "b", "c"] 1
```
```coffee
List.get ["a", "b", "c"] 100
```
@ -864,6 +867,7 @@ functions where argument order matters. For example, these two uses of `List.app
```coffee
List.append ["a", "b", "c"] "d"
```
```coffee
["a", "b", "c"]
|> List.append "d"
@ -875,9 +879,11 @@ sugar for `Num.div a b`:
```coffee
first / second
```
```coffee
Num.div first second
```
```coffee
first
|> Num.div second
@ -1020,9 +1026,11 @@ What we want is something like one of these:
```coffee
reverse : List elem -> List elem
```
```coffee
reverse : List value -> List value
```
```coffee
reverse : List a -> List a
```

View file

@ -2,16 +2,19 @@
# Running the benchmarks
Install cargo criterion:
```
cargo install cargo-criterion
```
To prevent stack overflow on the `CFold` benchmark:
```
ulimit -s unlimited
```
In the `cli` folder execute:
```
cargo criterion
```

View file

@ -30,6 +30,7 @@ But we can use these values and some of these are necessary for implementing bui
Right at the top of this module is a function called `builtin_defs`. All this is doing is mapping the `Symbol` defined in `module/src/symbol.rs` to its implementation. Some of the builtins are quite complex, such as `list_get`. What makes `list_get` is that it returns tags, and in order to return tags it first has to defer to lower-level functions via an if statement.
Lets look at `List.repeat : elem, Nat -> List elem`, which is more straight-forward, and points directly to its lower level implementation:
```
fn list_repeat(symbol: Symbol, var_store: &mut VarStore) -> Def {
let elem_var = var_store.fresh();
@ -54,6 +55,7 @@ fn list_repeat(symbol: Symbol, var_store: &mut VarStore) -> Def {
)
}
```
In these builtin definitions you will need to allocate for and list the arguments. For `List.repeat`, the arguments are the `elem_var` and the `len_var`. So in both the `body` and `defn` we list these arguments in a vector, with the `Symbol::ARG_1` and` Symvol::ARG_2` designating which argument is which.
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.
@ -77,6 +79,7 @@ After we have all of this, we need to specify if the arguments we're passing are
## 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:
```
#[test]
fn atan() {
@ -90,16 +93,19 @@ 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:
```
#[test]
fn atan() {
assert_evals_to!("Num.atan 10", 1.4711276743037347, f64);
}
```
But replace `Num.atan`, the return value, and the return type with your new builtin.
# Mistakes that are easy to make!!

View file

@ -71,10 +71,12 @@ Snippets are inserted based on type of value on which the cursor is located.
+ example: >> `percEncodedString = Url.percentEncode ^String^`
- command: list files in directory
+ example: >>
```
path <- File.pathFromStr ^String^
dirContents <- File.enumerateDir path
```
- command: remove/create file
- command: read/write from file
- command: concatenate strings

View file

@ -5,11 +5,13 @@
### 1. Build the Roc website
For a minimal build (when just working on the web REPL)
```bash
cp -r www/public www/build
```
Or, for a full build (with std lib documentation, downloadable source code, etc.)
```bash
www/build.sh
```

View file

@ -22,6 +22,7 @@ If you use lorri or direnv it is possible to load the dev flake instead of the r
For lorri:
1. copy the `shell.nix` at the root of this repo to the folder containing your dev tools flake.
1. edit `.envrc` to contain:
```
eval "$(lorri direnv --shell-file path-to-your-dev-flake-folder/shell.nix)"
```
@ -38,6 +39,7 @@ If your extension is not available on nix, you can add them [from the vscode mar
Instead of running `code` in the last step you can use the `--extensions-dir` flag to allow you to install extensions using the vscode GUI.
On MacOS or Linux:
```
code --extensions-dir="$HOME/.vscode/extensions"
```

View file

@ -125,6 +125,7 @@ to destructure variants inline in function declarations, like in these two examp
```elm
\(UserId id1) (UserId id2) ->
```
```elm
\(UserId id) ->
```
@ -137,6 +138,7 @@ You can write the above like so in Roc:
```elm
\UserId id1, UserId id2 ->
```
```elm
\UserId id ->
```
@ -1011,6 +1013,7 @@ list =
num + 1
```
Both snippets are calling `List.map` passing `numbers` as the first argument,
and a `\num -> num + 1` function for the other argument.