Using open but for just one type?
One of my favorite things about rescript is it’s ability to infer a type from usage. But that only works when the type is in the same module, I was wondering if there’s some kind of way to “open” that...
View ArticleUsing open but for just one type?
Unfortunately, you can only do that with values, not types: let {make} = module(User) (works) type {t} = module(User) (does not work) but I found out you can kinda do it with record spreads if the...
View ArticleFirebase modular bindings
Sure thing, fixed rescript-firebase/src/Firebase.res at main · nojaf/rescript-firebase · GitHub If anyone in the future is playing with Rescript & Firebase, feel free to reach out here.
View ArticleUsing open but for just one type?
Beware that this will create a new type that’s considered another type than User.t. You can of course use coercion with that type (someTValue :> User.t) but still, not quite the same as using the...
View ArticleUsing open but for just one type?
Right, it’s not really the equivalent of open but of include. Another way to do it is to have type t in a submodule and only open that one. module User = { module Type = { type t = { ... } } ... }...
View ArticleUsing open but for just one type?
Yeah having it in a submodule is probably the least invasive way of doing it.
View ArticleUsing open but for just one type?
Namespacing your types inside a module is a good habit anyway!
View ArticleUsing open but for just one type?
Isnt there a substitution type assignment? type t := User.t Generally strikes me as a bad idea but maybe?
View ArticleCurrent goal of genType with regard to type safety
Hello. A long time since I’ve posted here, so it’s possible I’ve missed something, although I have done a search to check. I have also been stuck on rescript@9 for several years, so I’ve totally...
View ArticleCurrent goal of genType with regard to type safety
I should add – this is what I currently see: And this is what I expected/hoped to see:
View ArticleFunc Prog Sweden
Hi everyone, A while back, I had the chance to give a virtual talk at Functional Programming Sweden. The experience was great, and I think it would be awesome if someone from the ReScript community...
View ArticleFunc Prog Sweden
You know, we have a Swede here who might even be able to join physically, right @zth? But other than that, we should rather speak at meetups where functional programming is NOT the central topic. Like...
View ArticleFunc Prog Sweden
Interesting feedback. Those in the functional programming community who are doing frontend work may have already decided on their preferred tools. It’s probably more important to inform the mainstream...
View ArticleRecursive types in nested modules
Hello, I would need to create bindings for recursive types, but I want the types to be in a separate module: module Foo = { module A = { type t = {b: B.t} // Gives error } module B = { type t = {a:...
View ArticleRecursive types in nested modules
Modules can be recursive as well, but then you need to give them explicit module type definitions: module Foo = { module rec A: { type t = {b: B.t} } = { type t = {b: B.t} } and B: { type t = {a: A.t}...
View ArticleRecursive types in nested modules
Thanks, I gave up and went for @get instead: module Foo = { type a type b module A = { @get external b: a => b = "b" } module B = { @get external a: b => b = "a" } } let a: Foo.a = %raw(`{}`)...
View ArticleJS API to compile ReScript to JS
Don’t think I tried it with runes. I would assume it works. The preprocessing stage just turns the svelte component into something the svelte compiler would understand, I think there is support for...
View ArticleDynamic property name
Hello, I need to create an object with a single property with a dynamic name. let key = "meh" // imagine any expression that returns a string here let a = { key: 4 } // doesn't work How can I achieve...
View Article