rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

Extra parentheses in pipe operator cause code to fail compilation.

Open Mng12345 opened this issue 1 year ago • 1 comments

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 decode = codec => codec.decode
}

The code above can be compiled in Rescript v10, but can not be compiled in V11.0.1 v10 playground

v11.0.1 playground

This code snippest is from the rescript-jzon library, and it prevents me from upgradding to Rescript v11.

Mng12345 avatar Feb 28 '24 09:02 Mng12345

You can use https://github.com/ds300/patch-package or https://pnpm.io/cli/patch. Or prepare a PR to add V11 support for rescript-jzon. I know the author and can ping him for review. He's not using ReScript anymore, so probably he won't have time to update the package by himself. Also, you can migrate to rescript-schema 😈

DZakh avatar Feb 28 '24 11:02 DZakh

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 23 '25 02:02 github-actions[bot]