https://github.com/glennsl/reason-syntax-guide
https://github.com/glennsl/reason-syntax-guide
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/glennsl/reason-syntax-guide
- Owner: glennsl
- Created: 2017-02-13T03:46:17.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-14T08:27:20.000Z (almost 9 years ago)
- Last Synced: 2025-01-22T00:36:34.724Z (12 months ago)
- Size: 12.7 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# reason-syntax-guide
This guide aims to quickly answer two questions you might get when you encounter unfamiliar syntax in Reason: What is this And where can I learn more? If it doesn't, please make ~~an issue or~~ a PR.
The guide is divided into these sections
* [Keywords](#keywords)
* [Operators and symbols](#operators-and-symbols)
* [Common user-defined operators](#common-user-defined-operators)
* [Constructs](#constructs)
## Keywords
Keyword | Usage | What is this? | Where can I learn more?
:--- | :--- | :--- | :---
`as` | `{ foo, bar } as record` | Binds the item being destructured to a name | [RWO](https://realworldocaml.org/v1/en/html/lists-and-patterns.html#terser-and-faster-patterns) - [OCaml Manual](http://caml.inria.fr/pub/docs/manual-ocaml/patterns.html)
`as` | `array 'a as 'this` | A type alias | [OCaml Manual](https://caml.inria.fr/pub/docs/manual-ocaml/types.html#sec97)
`fun`
`let`
`mutable`
`type`
`switch`
`rec`
`in`
`to`
`downto`
`module`
`module type`
`ref`
`true`
`false`
`if`
`else`
`for`
`while`
`open`
`exception`
## Operators and symbols
Operator/Symbol | Usage | What is this? | Where can I learn more?
:--- | :--- | :--- | :---
`+.`, `*.`, etc. | `3.1 +. 2.3` | Floating point operators |
`^` | `"Hello " ^ "world"` | String concatenation |
`##` | `obj##property` | Object (not record) property access |
`|>` | `"hello" |> print_string` | Pipe operator |
`@@`
`=>`
`|`
` ' `
`` ` ``
`::`
`{..}`
`...`
`;`
`==`
`===`
`!=`
`!==`
`_`
`land`
`lor`
`lxor`
`lnot`
`lsl`
`lsr`
`not`
`&&`
`||`
`:=`
## Common user-defined operators
`>>=`
`!?`
## Constructs
Syntax | Usage | What is this? | Where can I learn more?
:--- | :--- | :--- | :---
`[a, b, ...c]` | `let a = [1, 2, ...nums]` | Immutable list append |
`[_, _, ..._]` | `let [b, c, rest] = a` | List destructuring |
`type _ = | _ | _` |
`fun ⁔ => ...` |
`switch { | => ...` |
`{..}`
`{. ⁔ }`
`{ "": }`
`[| , |]`
`[@@...]`
`[%...]`
`/* ...*/`
` ? : `
`(, )`
`module (: ) => ...`
`<..>`