Guidance for nested data types
Hi. It is just a post for discussion. I know there is no silver bullet for all use cases, but when coming from TypeScript to ReScript type system, you need to change your view drastically. For...
View ArticleType redundancy between module signature .resi and modules .res
of course, if you use your types exactly the same way both inside and outside, this looks like useless duplication, but there are many cases where the types are not the same, you could have for...
View ArticleGuidance for nested data types
Well it depends a lot on what you want to achieve. The first design makes it easier to extend or to centralize error handling, but it might have less clear separation of concerns. The second makes it...
View ArticleGuidance for nested data types
The core principles of functional programming are immutability and separation of code and data. The most common and idiomatic way to apply this in rescript is with the following module architecture: a...
View ArticleGuidance for nested data types
I think it depends on how the rest of your app is going to be structured. I’m a sucker for doing #1 but it really works best if you’re handling it some single entry point and calling other methods to...
View ArticleWhat are your major pains with the VSCode extension?
related to vscode not extension but vscode can group related files together like folders, maybe the vscode extension could set the .vscode config via command or popup confirmation based on...
View ArticleMake lenses-ppx supporting uncurried mode
We found a “workaround” to this by using the value of the variant as the key and write by ourself the get and set value. let get: type value. @u (Lenses.state, Lenses.field<value>) => value =...
View ArticleIntroducing Bibimbob: VSCode Extension for ReScript Dependency Visualization
New features have been added in version v0.7.0: Unused module analysis Module name search in dependency graph Visualization tool changed from D3 to Graphviz marketplace.visualstudio.com Bibimbob -...
View ArticleHow to combine @send and @new
Hi, I’m a situation where I need to create bindings for the following: import kaplay from "kaplay"; let k = kaplay() let v = new k.Vec2(2,3) This sorta both needs @send and @new, but that leads to You...
View ArticleHow to combine @send and @new
Ended up using let mathRect: (t, Vec2.t, int, int) => Math.Shape.t = %raw(` function (k, pos, width, height) { return new k.Rect(pos, width, height); } `)
View ArticleNeed help with binding to a function with a complex type
Heyall, I’ve recently decided to take a look at rescript and I really like it, and I’ve been using it to rewrite a small thing I have in javascript, and while the rewrite was really successful, I need...
View ArticleNeed help with binding to a function with a complex type
Welcome to the wonderful world of ReScript! That example is quite tricky, but there are ways to handle it. First, I would simplify the parameterType to this: type parameterType = | @as("string")...
View ArticleNeed help with binding to a function with a complex type
hey, thanks you for letting me know about the tag decorator, that’s really nice to know. i’m kinda confused about the parameterType, because with the way you’re showcasing it in the code, it doesn’t...
View ArticleNeed help with binding to a function with a complex type
Right, I missed the fact that you need only the keys for the input, but in the result you need the values. So it’s type parameterTypeKeys = | @as("string") String | @as("number") Number |...
View ArticleNeed help with binding to a function with a complex type
thank you so much, that seems to work magnificently. it would be really awesome if it was possible for me to not have to switch on the value in the dict because i know it’s guaranteed to be whatever...
View ArticleNeed help with binding to a function with a complex type
I think it really depends on how you use this function, if you actually intend to process the result of this function, you’re then likely interested in the shape of this result. If you’re ok with a...
View ArticleNeed help with binding to a function with a complex type
oh wow, that looks really sweet to use, and yeah, i’m actually not too scared about the small runtime cost. i really really appreciate the time y’all spent helping me with this. i think i’d need some...
View ArticlegenType for core library
I’ve got exactly the same problem. I’m using JSON from core and need to export types to TS land. What do?
View ArticlegenType for core library
Hey, sorry that we didn’t reply earlier, but this should be fixed in the latest alpha of V12. If you use an older version, defining shims files for json and promise should fix it.
View Article