Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Record in list decomposed in a single step needs type hint, is this a bug?

$
0
0

to be honest I don’t understand how the first example can even compile:

let doIt = () => {
  // compiles
  let (x, y) = Definition.getList()
  let {a, b} = x
}

given it wouldn’t compile when not inside a function:

let (x, y) = Definition.getList()
let {a, b} = x

About why this happens, well ReScript type system follows Hindley-Milner type inference algorithm, I’m not sure what corner case leads to this phenomenon, but you’re more than welcome to fix it if you can!


Viewing all articles
Browse latest Browse all 2592

Trending Articles