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

Curried/uncurried single-argument functions

$
0
0

Building on this, I also discovered that the curried/uncurried single-argument functions can cause extremely obscure errors from @decco:

  We've found a bug for you!
  /project/src/MyModule.res

  This function is a curried function where an uncurried function is expected

With no line numbers or anything, this was super hard to track down, but eventually I figured out it was being caused by the t_encode and t_decode from another module which were declared as

let t_encode = Js.Json.string
let t_decode = Decco.stringFromJson

and in order to fix them I had to rewrite them to

let t_encode = j => Js.Json.string(j)
let t_decode = j => Decco.stringFromJson(j)

Which is baffling because I can’t for the life of me think of a single difference between these two implementations; aside from the redundancy of an extra lambda function.

Now I’m getting strange errors from modules which use Apollo ppx, which is making me nervous because if I have to update the ppx in order to get things working, that’ll be interesting…


Viewing all articles
Browse latest Browse all 2592

Trending Articles