Using operators as functions

Hello there. I’m trying to use the “++” operator in a reduce expression, and it doesn’t seem to work:

Using “+” operator works fine though. Why is that and what am I doing wrong?

AFAIK Rescript heavily discourages infix operators as arguments in functions. You should probably replace that with

Belt.List.reduce("", Js.String.concat)

If you really want to concat strings with an infix operator and lose any sort of readability of your code for anyone besides you, you can do

Belt.List.reduce("", \"^")

PS: ^ is Ocaml version of Rescript’s ++

The Js.String.concat works for me, thanks!
Using an OCaml operator in Rescript does seem to lose a bit of readability. The main thing for me was point-free-ness, which is fine this way. I wish we had Haskell-esque infix operators flexibility, even if not allowing to create custom ones. It’s much prettier in my opinion

It’s a little oddity of ReScript syntax, if you want to refer to or redefine the operators themselves, you need to use their OCaml names. E.g. == is = in OCaml, != is <>, and as you found out, ++ is ^.