Quantcast
Browsing all 1774 articles
Browse latest View live

Gleams use expression

roc-lang has something similar, which they call backpassing.

View Article


Gleams use expression

It looks elegant indeed! What I don’t like with all those sugars, though, is that it makes you focus on the happy path and often leads to overall bad error handling. I’ve never been a fan of ocaml let...

View Article


Gleams use expression

An elegant way to solve the problem in rescript actually already exists, just use exceptions instead of result / option monads and use reanalyze to track exceptions statically.

View Article

Image may be NSFW.
Clik here to view.

Gleams use expression

While chaining promises (without async/await) there is also the focus on the happy path. Don’t know if you handle it in another way? let result = promise->then()->then()->then()->catch()...

View Article

Weird error with module type

Although mxthevs offered a valid solution, I’d like to add a more thorough explanation because I get this question very often (especially from rescript beginners). The difference between the two...

View Article


Reasoning about "inheritance"

Hi, I would do it like this: ReScript Playground

View Article

Gleams use expression

I use pattern matching on awaits, whenever possible, if I use promises. This way I’m forced to thing / handle errors as well. let f = async x => switch await x() { | result =>...

View Article

Q: Just so we're clear, ALL declaration of imported JS modules must be...

It would be amazing to have a tool to auto-generate the bindings from typescript definition files.

View Article


@rescript/core: dependency or peerDependency?

It depends, just same as normal JS packages. Generally it should be peerDeps if you publish a library, otherwise put into dependency if you build app. More specifically, peerDeps describes...

View Article


How do you writing bindings today?

I do both. no problem there OCaml style modeling is still useful, so I won’t abandon it

View Article

Gentype: Typescript to Rescript types

is there any update on this topic ?

View Article

Gentype: Typescript to Rescript types

Wasn’t able to thoroughly test it myself yet, but the ReScript branch has been merged and there is a ReScript guide: https://github.com/ocsigen/ts2ocaml/blob/main/docs/rescript.md

View Article

Compile-step frontend frameworks and rescript

Vue integration is actually possible, since the lang attribute of <script> tag in SFC can receive anything. Therefore if we create a Vite plugin to transform ReScript files on demand, it would...

View Article


Image may be NSFW.
Clik here to view.

Recently came to ReScript? Give us your thoughts on error messages!

Here’s one that just caught me off guard for like half an hour. I have a manually curried function and couldn’t understand why my pipe wasn’t working let decode = decoder => data =>...

View Article

How to convert record to object?

I met this problem while dealing with GraphQL + Apollo. There are multiple queries that return structurally equivalent yet nominally different types. I want to handle the these polymorphically (in...

View Article


Unnecessarily strong type constraints with polymorphic variants (when using...

The following works (ReScript Playground): let f = v => { let x = ref(#b) x := v } let g = () => { let x = #a switch x { | #a => f(x) } } but the equivalent code using React.useState does not...

View Article

Debug mode with rescript 11.0

Does the debug mode flag -bs-g work with rescript 11.0? I’m getting some weird errors when I use it. Fatal error: exception File "jscomp/core/js_dump.ml", line 828, characters 29-35: Assertion failed

View Article


Debug mode with rescript 11.0

Is there any point in the debug mode now?

View Article

Debug mode with rescript 11.0

I was hoping to print a better type format in the console logs

View Article

Debug mode with rescript 11.0

I have removed the files that were causing the errors but I still can’t get a nice type format in the console. I have enabled Custom formatters in Google Chrome devtools.

View Article
Browsing all 1774 articles
Browse latest View live