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

Broken example code in Belt api

$
0
0

Oh yeah that’s a bit hard to grasp right now, this will be solved in ReScript v12, but for now you have this issue with the libraries shipped with the compiler (like Belt), it doesn’t automatically follow the (un)curried setting of your project, so you have to do it manually, so if you have set up your project in uncurried mode you have to use the U version of Belt functions, for example in this case (playground link), do this:

module Comparable1 = Belt.Id.MakeComparableU({
  type t = (int, int)
  let cmp = ((a0, a1), (b0, b1)) =>
    switch Pervasives.compare(a0, b0) {
    | 0 => Pervasives.compare(a1, b1)
    | c => c
    }
})

Viewing all articles
Browse latest Browse all 1787

Trending Articles