ANN vitest-bdd: ReScript testing with vitest (and source maps !)
Oh awesome! I have a couple projects I want to add unit tests to, so this is perfect timing.
View ArticleANN vitest-bdd: ReScript testing with vitest (and source maps !)
Awesome ! Let me know how it goes. Maybe also explore the Gherkins way. I found them super useful for “behavior” testing (like a complicated, multi-stage input). I use a mix of unit and feature tests...
View ArticleANN vitest-bdd: ReScript testing with vitest (and source maps !)
Wow this is awesome! How did you support source maps? Could you give some pointers?
View ArticleANN vitest-bdd: ReScript testing with vitest (and source maps !)
The full sources of the “compiler” is here. The basic idea is that I parse each lines of the original rescript code and the compiled code looking for corresponding tests. It is done in a way that...
View ArticleI'm looking into using ast-grep fo linting ReScript. What rules should I...
I don’t see any reason this couldn’t be made portable, and even a core part of the rescript experience. Just read this on the ast-grep docs too, so extensibility is actually already a solved problem....
View ArticlePublished my first Rescript binding to immutable js
npm rescript-immutable-js The `rescript-immutable-js` package provides ReScript bindings for the Immutable.js library.. Latest version: 0.1.0, last published: 6 hours ago. Start using...
View ArticleProposing new syntax for zero-cost unwrapping options/results
I’m all for this proposal At the moment switch case verbosity is so bad my Rust implementation has the same amount of lines as Rescript. let? Makes a lot of sense, the ? Shows the None is quick...
View ArticlePublished my first Rescript binding to immutable js
Welcome! Never felt the need for immutable-js in ReScript but it’s so cool that you already published a package after 2 nights of using ReScript.
View ArticleProposing new syntax for zero-cost unwrapping options/results
We could definitely support let? Error(err) = ... and let None = ... if that adds any value. Just a matter of swapping what’s emitted for the continue vs return case.
View ArticleProposing new syntax for zero-cost unwrapping options/results
In let? Ok(user) = fetchUser() If you see let? as testing if fetchUser() returns an Ok then yes I’d expect the reverse to be possible too, this also aligns to what we are used to in switch pattern...
View ArticleProposing new syntax for zero-cost unwrapping options/results
@lil5 I updated the PR supporting let? Error(e) = ... and let? None = .... PoC of let? by zth · Pull Request #7582 · rescript-lang/rescript · GitHub
View ArticleProposing new syntax for zero-cost unwrapping options/results
Looks good to me! Ship it!
View ArticleConsecutively array map with async
Codeberg.org rescript-snippets/src/ArrayAsync.res at main rescript-snippets I couldn’t find any helper functions to like Array.mapAsync or something so I wrote my own: let result = await ([1, 2,...
View ArticleConsecutively array map with async
Just a gotcha: neither ReScript nor your JS engine will optimize it. While synchronous recursive functions can be optimized by ReScript into a JS while loop, asynchronous functions can not. But there...
View ArticleConsecutively array map with async
Anything wrong with this ? let mapAsync = (arr, fn) => arr->Array.map(fn)->Promise.all
View ArticleConsecutively array map with async
@gaspard Promise.all runs the promises in parallel, if I’m running db queries or http calls inside them it could have unintended consequences.
View ArticleConsecutively array map with async
As everything can be an expression I tried for ... in .. to .. async { which didn’t work, so yeah my first attempt was to do recursion, that’s learning Thanks I’ve updated the code and its working well!
View ArticleDocumentation generator to website
Codeberg.org rescript-docs-gen rescript-docs-gen mkdir -p ./src/data/file npx rescript-tools@0.6.6 doc <my_project>/src/File.res > ./src/data/file/File.json pnpm install pnpm run dev Example:...
View ArticleDocumentation generator to website
I’ve added Sury as a package to try documenting external packages https://rescript-reasonably-typed.netlify.app/reference/sury/s/ This is my script I used to add it: update.sh
View ArticleDocumentation generator to website
Wow this is great! Documentation is definitely something a bit subpar in the ecosystem, such initiatives can improve the situation a lot! Thanks @lil5!
View Article