RescriptRelay with ReScript Core

Does anyone use RescriptRelay with the newest setup for Rescript project with @rescript/core: 1.3.0?

I can run with a similar stack as in RescriptRelay repo’s example, with Rescript 11 but if I add @rescript/core: 1.3.0 I get:

%relay ppx: This function is a curried function where an uncurried function is expected

Probably the same problem as here

I tried with adding “-uncurried” to ppx flags with no luck.
I’m curious if anyone encounters a similar issue and found a workaround.

I have this setup and it works flawlessly, are you sure you set your project as uncurried?

Sorry for the long delay but I was busy, and I didn’t have time to replicate it properly :pensive:

I assume with Rescript 11 it should be uncurried by default, but I added

  "uncurried": true,

to rescript.json just in case.
I took the default rescript project setup npm create rescript-app@latest with the newest versions and installed rescript-relay exactly as described in Getting Started section.
I added a simple schema and created repro repository (query in src/App.res).

What I got:

FAILED: src/App.cmj

  We've found a bug for you!
  /path/test-relay/src/App.res:1:16-9:2

   1 │ module Query = %relay(`
   2 │   query AppQuery {
   . │ ...
   8 │   }
   9 │ `)
  10 │
  11 │ @react.component

  This function is a curried function where an uncurried function is expected

FAILED: cannot make progress due to previous errors.

I tested it with:

  • node: v20.10.0
  • npm: 10.2.3
  • yarn: 1.22.21
  • OS: Ubuntu 22.04.4 LTS (WSL)

I also tried adding -uncurried to bsc-flags, and with @@uncurried at the top of the file and RescriptRelay "3.0.0-rc.4" with no result.

The main problem here is unfortunately that 3.0.0 hasn’t been released yet, so the install instructions haven’t been updated to match that version (it’s for 2.0.0 now). Hoping to get it released very soon!

Here’s a patch that fixes that repo:

diff --git a/package.json b/package.json
index 732d138..fef336c 100644
--- a/package.json
+++ b/package.json
@@ -19,11 +19,10 @@
     "@rescript/react": "^0.12.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",
-    "react-relay": "15.0.0",
-    "relay-compiler": "^16.2.0",
-    "relay-runtime": "15.0.0",
+    "react-relay": "16.0.0",
+    "relay-runtime": "16.0.0",
     "rescript": "^11.1.0",
-    "rescript-relay": "^2.3.0",
+    "rescript-relay": "^3.0.0-rc.5",
     "watchman": "^1.0.0"
   },
   "devDependencies": {
diff --git a/rescript.json b/rescript.json
index 2862c36..2ae15bd 100644
--- a/rescript.json
+++ b/rescript.json
@@ -13,7 +13,7 @@
     }
   ],
   "uncurried": true,
-  "ppx-flags": ["rescript-relay/ppx"],
+  "ppx-flags": [["rescript-relay/ppx", "-uncurried"]],
   "suffix": ".res.mjs",
   "bs-dependencies": [
     "@rescript/core",

2 Likes

Wrapping ppx-flags with another list made it for me! :smile:
Thanks a lot!

2 Likes