Skip to content

Commit 785191b

Browse files
committed
Add back cli quick try
1 parent ea34ee2 commit 785191b

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

pages/docs/manual/latest/try.mdx

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,32 @@ You can also get the inferred signature directly via `bsc -i MyFile.res`
4343
let fib: int => int
4444
```
4545

46-
<!-- TODO: add this back next version. Currently not outputting res -->
47-
48-
<!-- You can quickly test code snippets in the console: -->
49-
<!-- ``` -->
50-
<!-- bsc -e 'let add = (x, y) => x + y' -->
51-
<!-- // Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE -->
52-
<!-- 'use strict'; -->
53-
<!-- -->
54-
<!-- -->
55-
<!-- function id(x) { -->
56-
<!-- return x; -->
57-
<!-- } -->
58-
<!-- -->
59-
<!-- exports.id = id; -->
60-
<!-- ``` -->
61-
<!-- -->
62-
<!-- Pass the `-i` flag to infer the signature: -->
63-
<!-- -->
64-
<!-- ``` -->
65-
<!-- bsc -i -e 'let id = x => x' -->
66-
<!-- let id: 'a => 'a; -->
67-
<!-- ``` -->
46+
You can quickly test code snippets in the console:
6847

48+
```sh
49+
bsc -e 'let add = (x, y) => x + y'
50+
// Generated by ReScript, PLEASE EDIT WITH CARE
51+
'use strict';
52+
53+
54+
function add(x, y) {
55+
return x + y | 0;
56+
}
57+
58+
exports.add = add;
59+
/* No side effect */
60+
```
61+
62+
Pass the `-i` flag to infer the signature:
63+
64+
```sh
65+
bsc -i -e 'let id = x => x'
66+
let id: 'a => 'a
67+
```
68+
69+
**To evaluate a script quickly, pipe the output to Node**:
70+
71+
```sh
72+
bsc -e 'let add = (x, y) => x + y; Js.log(add(1, 2))' | node
73+
3
74+
```

0 commit comments

Comments
 (0)