With ReScript 11, what is the recommended wayt to serialize/deserialize JSON
The new dict{} syntax will be useful. See Dictionary | ReScript Language Manual
View ArticleUse ReScript with Svelte
If anyone who knows Svelte is interested in pursuing this it’d be fun to throw some ideas around. <script lang="res"> would be cool!
View ArticleIonic Rescript bindings
I agree. Yes I have gone down that route and back. But I think style has a huge upside time-saving. More importantly all bindings should be made as permissible as possible (for now) otherwise users...
View ArticleUse ReScript with Svelte
So Svelte has docs on their preprocessor, which easily lets you access and replace content within the <script> tag. So in your .svelte file, you can do: <script lang="res">...
View ArticleUse ReScript with Svelte
You might make this work by using a temporary file. Using latest v12 alpha you can get the compiler arguments from rewatch npx rewatch --rescript-version 12.0.0-alpha.13 --compiler-args...
View ArticleHow to make .resi files dumped from react files compiler friendly?
I found this today while generating ‘.resi’ files to a bunch components. For bindings, I settled with the approach of providing the types props and annotate make like this: type theme module Provider:...
View ArticleUse ReScript with Svelte
Yeah, what @nojaf suggests above would be a great way to test this put. Doing some minor research, it seems that .svelte files are only ever imported into other .svelte files for using as components,...
View ArticleUse ReScript with Svelte
There’s also the possibility of also writing the ReScript found in Svelte script tags to actual files, kind of like you describe @hellos3b. Lots of possibilities. We can figure out a nice approach for...
View Article[ANN] ReScript Roadmap 2025
Heads up: I needed to update the estimated timeline a bit since it’s June already. We found a few more small blockers that need to be resolved. Sorry…
View ArticleThis open statement shadows the label
I have another one of these I don’t get: module DOMAPI = { type timeoutId } module Global = { open DOMAPI external setTimeout: (~handler: unit => unit, ~timeout: int=?) => timeoutId =...
View ArticleUse ReScript with Svelte
I made a small PoC that implements support for <script lang="res"> in .svelte files. There’s plenty of things to fix, but this shows that it’s possible: GitHub - zth/rescript-svelte-example: PoC...
View ArticleThis open statement shadows the label
this comes from the fact you’re shadowing Stdlib.timeoutId that is globally available.
View ArticleHow to compose async results?
Hi folks! After migrating all of my fetches and indexdb calls to promise<result<'a, exn>> it has become really annoying to unwrap and pattern match a chain of calls. Is there a better way...
View ArticleHow to compose async results?
ReScript community usually steers towards using “simple” solutions and tries to avoid monadic composition and point free style most of the time. Having said that, your solution looks quite OK since...
View ArticleHow to compose async results?
Not sure I’m completely answering the question here, but lately I’ve been using a pretty light weight pipeable pattern using polyvariants to accumulate errors. A superficial example: type parsed =...
View ArticleHow to compose async results?
How would you catch anything unexpected in this setup? Suppose you are calling some external function that returns a promise. And somewhere along the way, a promise gets rejected.
View ArticleHow to compose async results?
I forgot to add that in my example. I updated it to handle general errors as well. Essentially it’s just about adding an exception branch to each of the okThenX functions, and return a general error...
View ArticleHow to compose async results?
Thanks this is interesting, added a custom exception to see how that play out, sample. This sounds like a good candidate for either a helper library or a recipe on the docs website.
View ArticleHow to compose async results?
Imho, the problem here has nothing to do with rescript, but rather the function coloring that happens with async in particular. The reason this doesn’t become as apparent in e.g. js or ts is because...
View Article