Skip to content

Commit 1b513b0

Browse files
author
Hongbo Zhang
committed
update docs
1 parent aa47313 commit 1b513b0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

docs/OCaml-call-JS.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,18 @@ improve the generated code.
3333
}
3434
|}]
3535
```
36-
In the expression level, i.e, `[%bs.raw ...]` user can add a type annotation, the compiler would use such type annotation to deduce its arities. for example, the next three versions:
36+
In the expression level, i.e, `[%bs.raw ...]` user can add a type
37+
annotation, for example:
3738

3839
```ocaml
39-
let f = [%bs.raw ("Math.max" : float -> float -> float) ] 3.0
40-
let f : float -> float -> float = [%bs.raw "Math.max" ] 3.0
41-
let f = ([%bs.raw "Math.max"] : float -> float -> float ) 3.0
40+
let f : float * float -> float [@uncurry] = [%bs.raw "Math.max" ]
41+
in f (3.0, 2.0) [@uncurry]
4242
```
4343
will be translated into
4444

4545
```js
46-
function f(prim){
47-
return Math.max(3.0,prim);
48-
}
46+
var f = Math.max ;
47+
f(3.0,2.0)
4948
```
5049
Caveat:
5150
1. So far we don't do any sanity check in the quoted text (syntax check is a long-term goal)

0 commit comments

Comments
 (0)