182 questions
0
votes
1
answer
67
views
What is the difference between option<t>=? and just =? in ReScript JSX?
From the documentation of ReScript React, I can declare a component like this:
module OptionalChildren = {
@react.component
let make = (~children: option<React.element>=?, ~children2: React....
0
votes
2
answers
198
views
Convert Json array to list of strings
I am reading this tutorial https://www.stackbuilders.com/blog/nonsense-getting-started-with-reason-and-reason-react/. One of the problems I am facing is that api.noopschallenge.com is now dead. I ...
0
votes
0
answers
73
views
Longident.flat error when trying to migrate a file from bucklescript to rescript
Trying to rescript bucklescript-tea and after using rescript convert -all
All the files converted except for 2 files that handle http stuff this error showed up
Fatal error: Longident.flat
Fatal error:...
1
vote
1
answer
197
views
Curry.js error when exporting a rescript function with more than 1 parameter using genType
When exporting a function with more than 1 parameter (2 or more) it throws the following error, which basically says there is an issue with the way we import curry.js. I am attaching an example and ...
3
votes
1
answer
275
views
How do I implement hash functions for arbitrary record types in ReScript?
I'm exploring ReScript for the first time. I want to build a hashmap using a record type as my key type, and I'm looking for guidance on implementing the hash function.
Here's my ReScript code:
type ...
0
votes
1
answer
86
views
Why can't I assign a 64bit integer to this field?
Is there a numeric suffix I should be using to assign a numerical constant value to an int64 type?
A moderately editted version of the error is:
We've found a bug for you!
{file}.re:321:20-31
321 │ ...
2
votes
1
answer
211
views
How to read JSON with unknown key in ReasonML?
I am writing a simple application that display dog images from Dog API. I used bs-json to make it a record and use it later. The list of breeds can be obtained by the API. The response looks like this....
2
votes
1
answer
783
views
How would I write a generic function to handle multiple record types in ReScript?
Given the following contrived example, is it possible to write a get function that can handle any record with an a property?
type type_one = {a: int}
type type_two = {a: int, b: int}
let example_one =...
2
votes
1
answer
311
views
Infinite Lists / Streams in ReScript
I can't seem to find the correct typing for an infinite list in ReScript.
I first tried:
type rec stream<'a> = ('a, () => ('a, stream<'a>))
Which was incorrect because ReScript thought ...
2
votes
3
answers
464
views
How do you call an uncurried function with unit in ReScript/ReasonML?
Say that I have an uncurried function like:
let echo(. a) = a;
I can call this funcition fine with most literals like:
echo(. 1)
echo(. "Hello")
but when I am trying to call it with void, ...
1
vote
1
answer
375
views
How can one iterate/map over a Js.Json.t that is an array?
I'm trying to decode a JSON array that has the type Js.Json.t (not array(Js.Json.t) apparently). A call to Js.log(jsonList) reveals that it is an array, but I'm not certain how to map over the ...
0
votes
0
answers
542
views
Is it possible to partially compile a Reason+React application?
I was thinking of making the dev experience as smooth as possible and the feedback loop as short as possible when compiling the Reason+React application. If I use
import React from 'react';
in a file,...
0
votes
1
answer
464
views
How to set a dynamic value as a Js.t key in ReScript?
Is there a way to set a dynamic value as a Js.t key in ReScript?
0
votes
1
answer
528
views
How to convert a Js.Dict.t to Js.t in ReScript?
Is there a straight forward way to convert a Js.Dict.t like this one
Js.Dict.fromArray([
("bigKey", Js.Dict.fromArray([("smallKey", "value")]))
])
to Js.t like this ...
1
vote
1
answer
369
views
How do I use an unwrapped polymorphic variant [union type] in a type parameter?
The Goal: Binding to the Service Worker Cache
I'm writing a binding to let me write Service Workers in ReScript. String URLs and Requests are sometimes used interchangeably.
Where possible, I'm ...