Why the function call in pipe expression needs to wrap parentheses now?

module Codec = {
  type encode<'v> = 'v => Js.Json.t
  type decode<'v> = Js.Json.t => result<'v, exn>
  type t<'v> = {
    encode: encode<'v>,
    decode: decode<'v>,

  let make = (encode, decode) => {encode: encode, decode: decode}

  let encode = codec => codec.encode
  // let encodeString = (codec, value) => (codec->encode)(value)->Js.Json.stringify
  let encodeString = (codec, value) => codec->encode(value)->Js.Json.stringify

  let decode = codec => codec.decode

The code let encodeString = (codec, value) => codec->encode(value)->Js.Json.stringify is able to be compiled in version v10 but not in v11.
issue here

Because it’s uncurried. If you change the code to :arrow_down: it won’t be needed:

  let encode = (codec, value) => codec.encode(value)
1 Like

I thought the pipe operator can automatically recognize and handle this situtation. :smiling_face_with_tear:

There are a lot of libraries need to modify their code to upgrade to v11…

Could you share a list?

I do not have the list, i just thought the new version of the pipe might cause these changes.

It’s not really a pipe, it’s more about uncurried mode.

1 Like