Skip to content

Commit

Permalink
Merge pull request #69 from mattjbray/melange3
Browse files Browse the repository at this point in the history
chore: updates for melange 3.0
  • Loading branch information
mattjbray authored Mar 18, 2024
2 parents 9aea50c + 7de6268 commit a535bf4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build
on:
pull_request:
push:
branch:
branches:
- master

jobs:
Expand Down Expand Up @@ -41,6 +41,7 @@ jobs:
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
cache-prefix: v2
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-depext-flags: --with-test
opam-local-packages: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ clean:

_opam:
opam switch create . --empty
opam switch set-invariant ocaml-base-compiler.4.14.1

install-dependencies: _opam
opam switch set-invariant ocaml-base-compiler.5.1.1
opam install . --deps-only --with-test

DOCS_WORKTREE_PATH=../ocaml-decoders-doc
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
(ocaml (>= 4.14.1))
(odoc :with-doc)
(decoders (= :version))
melange
(melange (>= 3.0.0))
(melange-fetch :with-test)
(melange-jest :with-test)
(melange-webapi :with-test)))
2 changes: 1 addition & 1 deletion melange-decoders.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ depends: [
"ocaml" {>= "4.14.1"}
"odoc" {with-doc}
"decoders" {= version}
"melange"
"melange" {>= "3.0.0"}
"melange-fetch" {with-test}
"melange-jest" {with-test}
"melange-webapi" {with-test}
Expand Down
8 changes: 4 additions & 4 deletions src-js/js_json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ module Decode = struct
let oks, errs =
arr
|> Js.Array.reducei
(fun (oks, errs) x i ->
~f:(fun (oks, errs) x i ->
match decoder.dec x with
| Ok a ->
let _ = Js.Array.push a oks in
let _ = Js.Array.push ~value:a oks in
(oks, errs)
| Error e ->
let _ =
Expand All @@ -82,7 +82,7 @@ module Decode = struct
errs
in
(oks, errs) )
([||], [||])
~init:([||], [||])
in
if Js.Array.length errs > 0
then
Expand Down Expand Up @@ -123,5 +123,5 @@ module Encode = struct
include Encode.Make (Json_encodeable)

let array encoder xs =
xs |> Js.Array.map (fun x -> encoder x) |> Js.Json.array
xs |> Js.Array.map ~f:(fun x -> encoder x) |> Js.Json.array
end
8 changes: 4 additions & 4 deletions src-js/js_xml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module DOMParser = struct
[@@mel.get]

external querySelector :
Dom.element -> string -> Dom.element Js.null_undefined = "querySelector"
Dom.element -> string -> Dom.element Js.nullable = "querySelector"
[@@mel.send]

external textContent : Dom.element -> string = "textContent" [@@mel.get]
Expand Down Expand Up @@ -96,7 +96,7 @@ module Element = struct


external append : Dom.element -> Dom.node array -> unit = "append"
[@@mel.send] [@@variadic]
[@@mel.send] [@@mel.variadic]

external setAttribute : Dom.element -> string -> string -> unit
= "setAttribute"
Expand All @@ -114,10 +114,10 @@ end

module Document = struct
external createElementNS : string -> string -> Dom.element = "createElementNS"
[@@scope "window", "document"]
[@@mel.scope "window", "document"]

external createTextNode : string -> Dom.text = "createTextNode"
[@@scope "window", "document"]
[@@mel.scope "window", "document"]
end

module Encode = struct
Expand Down

0 comments on commit a535bf4

Please sign in to comment.