Skip to content

Commit

Permalink
fixes after latest melange
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavarri committed Dec 9, 2023
1 parent 46f30da commit 82f0751
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions docs/communicate-with-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ clear:

```ocaml
external draw : x:int -> y:int -> ?border:bool -> unit -> unit = "draw"
[@@module "MyGame"]
[@@mel.module "MyGame"]
let () = draw ~x:10 ~y:20 ~border:true ()
let () = draw ~x:10 ~y:20 ()
Expand Down Expand Up @@ -1695,7 +1695,7 @@ order that was used when declaring the function:

```ocaml
external draw : x:int -> y:int -> ?border:bool -> unit -> unit = "draw"
[@@module "MyGame"]
[@@mel.module "MyGame"]
let () = draw ~x:10 ~y:20 ()
let () = draw ~y:20 ~x:10 ()
```
Expand Down Expand Up @@ -2763,7 +2763,7 @@ type pet = { name : string } [@@deriving accessors]
let pets = [| { name = "Brutus" }; { name = "Mochi" } |]
let () = pets |. Belt.Array.map name |. Js.Array2.joinWith "&" |. Js.log
let () = pets |. Belt.Array.map name |. Js.Array.join ~sep:"&" |. Js.log
```
```reasonml
[@deriving accessors]
Expand Down Expand Up @@ -2850,15 +2850,15 @@ Let’s see an example. Considering this Melange code:
```ocaml
type person = {
name : string;
age : int option; [@optional]
age : int option; [@mel.optional]
}
[@@deriving abstract]
```
```reasonml
[@deriving abstract]
type person = {
name: string,
[@optional]
[@mel.optional]
age: option(int),
};
```
Expand Down Expand Up @@ -2896,7 +2896,7 @@ Here is an example of how we can use it:
<!--#prelude#
type person = {
name : string;
age : int option; [@optional]
age : int option; [@mel.optional]
}
[@@deriving abstract]
-->
Expand Down Expand Up @@ -2935,7 +2935,7 @@ The functions `nameGet` and `ageGet` are accessors for each record field:
<!--#prelude#
type person = {
name : string;
age : int option; [@optional]
age : int option; [@mel.optional]
}
[@@deriving abstract]
let alice = person ~name:"Alice" ~age:20 ()
Expand Down
12 changes: 6 additions & 6 deletions scripts/communicate-with-javascript.t
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ file. To update the tests, run `dune build @extract-code-blocks`.
>
> type person = {
> name : string;
> age : int option; [@optional]
> age : int option; [@mel.optional]
> }
> [@@deriving abstract]
> let alice = person ~name:"Alice" ~age:20 ()
Expand All @@ -84,7 +84,7 @@ file. To update the tests, run `dune build @extract-code-blocks`.
>
> type person = {
> name : string;
> age : int option; [@optional]
> age : int option; [@mel.optional]
> }
> [@@deriving abstract]
>
Expand Down Expand Up @@ -114,7 +114,7 @@ file. To update the tests, run `dune build @extract-code-blocks`.
$ cat > input.ml <<\EOF
> type person = {
> name : string;
> age : int option; [@optional]
> age : int option; [@mel.optional]
> }
> [@@deriving abstract]
> EOF
Expand Down Expand Up @@ -142,7 +142,7 @@ file. To update the tests, run `dune build @extract-code-blocks`.
>
> let pets = [| { name = "Brutus" }; { name = "Mochi" } |]
>
> let () = pets |. Belt.Array.map name |. Js.Array2.joinWith "&" |. Js.log
> let () = pets |. Belt.Array.map name |. Js.Array.join ~sep:"&" |. Js.log
> EOF

$ dune build @melange
Expand Down Expand Up @@ -518,7 +518,7 @@ file. To update the tests, run `dune build @extract-code-blocks`.
$ cat > input.ml <<\EOF
> external draw : x:int -> y:int -> ?border:bool -> unit -> unit = "draw"
> [@@module "MyGame"]
> [@@mel.module "MyGame"]
> let () = draw ~x:10 ~y:20 ()
> let () = draw ~y:20 ~x:10 ()
> EOF
Expand All @@ -527,7 +527,7 @@ file. To update the tests, run `dune build @extract-code-blocks`.
$ cat > input.ml <<\EOF
> external draw : x:int -> y:int -> ?border:bool -> unit -> unit = "draw"
> [@@module "MyGame"]
> [@@mel.module "MyGame"]
>
> let () = draw ~x:10 ~y:20 ~border:true ()
> let () = draw ~x:10 ~y:20 ()
Expand Down

0 comments on commit 82f0751

Please sign in to comment.