Quantcast
Channel: ReScript Forum - Latest posts
Browsing all 2592 articles
Browse latest View live

Module functors vs. records-of-functions for interface/implementation separation

CCA is my employer’s company name. Or “Control Center Apps” in full.

View Article


My main gripes with rescript (constructive criticism)

i forgot to bring one point up and that is tracking internal mutability: i get that this might be a difficult line to draw given the coupling with js, but it’s not obvious that array is internally...

View Article


My main gripes with rescript (constructive criticism)

I think there’s a plan to introduce an immutable array module in the stdlib for this.

View Article

My main gripes with rescript (constructive criticism)

right but it holds true for a slew of types, Array, Dict, TypedArray and probably more. maybe they will be addressed too? i would love for immutability to be the default in rescript. this would be a...

View Article

My main gripes with rescript (constructive criticism)

if it’s an issue you have with many types, maybe it’s something that could be better achieved with linting or by providing your own immuatable versions of these types.

View Article


My main gripes with rescript (constructive criticism)

Yeah this has been discussed at length before, and ReScript’s stdlib is intended to stay close to JS. So it won’t be made immutable by default. However, it’s easy enough to set up your own immutable...

View Article

ReScript-v12.0.0-rc.1: deprecated: Js_OO.Callback.arity2

Now that rescript-v12.0.0-rc.1 defaults warning to error, I am getting the deprecation warning with the example from the official documentation How do you model a callback with @this and arity >=...

View Article

ReScript-v12.0.0-rc.1: deprecated: Js_OO.Callback.arity2

Thanks for reporting, will look into this.

View Article


ReScript-v12.0.0-rc.1: deprecated: Js_OO.Callback.arity2

@dsiu deprecating this was too soon, and a mistake by me. Fixed here: Undeprecate Js_OO since it is still used by zth · Pull Request #7955 · rescript-lang/rescript · GitHub Will be in the next RC,...

View Article


Unions between polymorphic variants behind module types

i’m trying to compose two modules in a Module Function and i’d like for them to be able to expand a return type. i essence, im trying to do this: module type T = { type t<'a> = [> ] as 'a }...

View Article

Unions between polymorphic variants behind module types

experimenting a bit more, i think this is just something that hasn’t been implemented in the compiler’s type inference: module type T = { let foo: unit => [> #x] } module A: T = { let foo: unit...

View Article

ReScript-v12.0.0-rc.1: deprecated: Js_OO.Callback.arity2

@zth : Thanks for the quick fix.

View Article

Unions between polymorphic variants behind module types

You can do this: module type T = { type t } module A: T with type t = [#a] = { type t = [ #a] } module B: T with type t = [#b] = { type t = [ #b] } module C = { type t = [A.t | B.t] let a: t = #b } If...

View Article


Unions between polymorphic variants behind module types

thanks, that’s clever and i didn’t know that was expressible, but that still doesn’t work with a Module Function that takes two Ts, which is what i’m doing.

View Article

Unions between polymorphic variants behind module types

well you could use the same technique with module functions but it’s rather similar: module type T = { type t } module Make = (A: T with type t = [#a], B: T with type t = [#b]) => { type t = [A.t |...

View Article


Unions between polymorphic variants behind module types

i’m trying to compose two modules in a Module Function with polymorphic variants A.t and B.t to module C with C.t = [A.t|B.t] for the reason that they both have a PV return typ in A.tryMap and...

View Article

Avoiding Obj.magic idioms?

what are some ways to avoid Obj.magic sprinkled all over your code? I always try hard to avoid this, but also always end up with Obj.magic all over the place in my rescript code bases. as a habit,...

View Article


Unions between polymorphic variants behind module types

Polymorphic variants compose naturally by design, eg: let foo = Error(#FooError) let bar = foo->Result.flatMap(foo => switch foo { | 0 => Error(#Zero) | other => Ok(other) }) Why do you...

View Article

Unions between polymorphic variants behind module types

in rescript, there’s no way to express the fact that a type is of the kind of a generic variant, record, or polymorphic variant. It’d be hard to implement anyway because in such cases, if you have no...

View Article

Avoiding Obj.magic idioms?

I think the issue in your code comes from the fact you treat all these values as unknown or whatever the typescript type is supposed to be and then try to narrow down their types at runtime. But...

View Article
Browsing all 2592 articles
Browse latest View live