Console.log with return value
Definitely an interesting idea. I like logAndReturn (+ functions for the other variants outside of log) best in terms of naming.
View ArticleConsole.log with return value
more generally, I’d be in favor of having a function that applies a side effect and returns its parameter, we could call it tap, I find it more flexible: let tap = (x, f) => { f(x) x } let foo =...
View ArticleConsole.log with return value
definitely also very useful. I think that many devs use console.log to quickly debug stuff. Although ->tap(Console.log) is shorter than ->Console.logAndReturn, I would prefer the latter one if...
View ArticleConsole.log with return value
What about implementing both? Please choose one; there’s no need to define two new things that serve the same purpose. I would prefer tap to maintain flexibility. I might want to use a logger or an...
View ArticleConsole.log with return value
I’ve used a tap command with fp-ts pipes. It console logs and takes an optional label. let tap = (x, f) => { f(x) x } let foo = "foo"->tap(~label="bar")
View ArticleConsole.log with return value
I’ve something similar, let trace = (~label: string="", obj: 'a) => { Js.log2(label, obj) obj } I prefer this sort of helper to be in userspace. If we decided to add this as a built-in function,...
View ArticleIonic Rescript bindings
Thank you for sharing this. It’s great users now have another option for trying apps that need to look close to native. I tried Ionic a few months ago and discovered that className and style are...
View ArticleIonic Rescript bindings
Not related to Rescript lol but using style in Ionic is a bit of anti-pattern. I see it in devs that are used to Tailwaind but in Ionic you are supposed to use regular CSS and often edit CSS...
View ArticleConsole.log with return value
Thanks for all of your input. Since the rescript core has a few ...with... functions, I thought this is the recommended way. There are only bindings to native js functions in the Console module, so I...
View ArticleConsole.log with return value
I’d be in favor of having tap in the stdlib, I think such a PR would have reasonable chances to get merged.
View Article[Video] Building a snake game with KAPLAY
Hi folks, Over the weekend I made a video about KAPLAY Building a game with ReScript & KAPLAY Please consider liking the video so it can appear in other people’s suggestions! It would be a great...
View Article[ANN] ReScript Roadmap 2025
Hello folks! We successfully concluded the ReScript Retreat 2025 that took place once again here in Vienna, Austria, from the 3rd to the 5th of May. Last year we created a concise roadmap for 2024...
View ArticleCreating larger bindings project
When I create bindings, I typically have one file with all the bindings to a specific node package. This works fine, but now I have a lot of bindings and a lot of nested modules. It feels like I’m...
View ArticleCreating larger bindings project
Not specifically for bindings, but when I have a lot of nested modules inside a “main” module, I start to create files like Kaplay_Collision.res, Kaplay_Math, etc. and reexport (not allways) these...
View ArticleCreating larger bindings project
Monorepo for sure, define your submodules as different modules and use namespace: true in the rescript.json packages snake src Snake.res kaplay src Debug.res Vec2.res PosComp.res
View Article[ANN] ReScript Roadmap 2025
Thank you so much for the work you’re putting into this, I don’t know what I’d do if ReScript didn’t exist (probably sit around fantasizing of a sane language that can be run on the nodejs platform…!).
View Article[ANN] ReScript Roadmap 2025
Here you go: https://www.printful.com/product-template/89005284/0b07206c16c9e1728d6ccbc28b420c5b This is the same as the retreat t-shirt, just without the sponsor text on the back. Shipping costs...
View ArticleWith ReScript 11, what is the recommended wayt to serialize/deserialize JSON
Gonna revitalize this thread, now with v12 on the horizon How are we decoding and encoding json? Right now I have projects using spice and sury (formally rescript-struct). I’ve also tried using native...
View Article