Questions tagged [reasonml]

For questions related to ReasonML, an ML-variant with a syntax friendly to JavaScript developers.

For questions related to ReasonML, an ML-variant with a syntax friendly to JavaScript developers.

6 questions
14
votes
2 answers

How do I declare a map type in Reason ML?

One advantage of Reason ML over JavaScript is that it provides a Map type that uses structural equality rather than reference equality. However, I cannot find usage examples of this. For example, how would I declare a type scores that is a map of…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
6
votes
2 answers

graphql reason-apollo - recursive parsing of options

I'm using Reason-Apollo to parse a pretty nested GraphQL response from my server. I'm having trouble parsing the hairy tree of options returned from my GraphQL server (I'm using django-graphene). Here is the GraphQL query and the Reason React…
Myer
  • 3,670
  • 2
  • 39
  • 51
5
votes
1 answer

Error while compiling reducerComponent "Is this a ReasonReact reducerComponent or component with retained props?"

I'm getting an error when creating a reducerComponent: Code type state = {repoData: RepoData.repo}; let dummyRepo: RepoData.repo = { stargazers_count: 27, full_name: "jsdf/reason-react-hacker-news", html_url:…
Ashley Coolman
  • 11,095
  • 5
  • 59
  • 81
4
votes
3 answers

Does ReasonML support async/await?

I have been going through the JS -> Reason cheatsheet on the Reason ML website. They are very helpful, but none cover the async/await syntax available in modern ES. What is the Reason ML equivalent of this? import fs from 'mz/fs'; // A cat-like…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
3
votes
1 answer

What are the integer types and modules in Reason ML?

I was trying to write some code using the Int32 library, but I hit a type error: let x : int = 7; Int32.abs(x) This has type: int But somewhere wanted: int32 I was a bit surprised by this, because in other languages int is just an alias for…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
1
vote
1 answer

Why is my Map type not exported by Reason?

Following this question, I have created a file (and hence module) that defines a concrete Map type: /* Scores.re */ module StringMap = Map.Make({ type t = string; let compare = compare }); type scores = StringMap.t(int); Now, I want to use…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245