Trouble migrating decco to rescript11

Hello there,
I have converted reason files in decco to rescript using rescript@9 convertor. Now since decco uses ppx to create decoders&encoders for types. with new rescript11 I"m getting this error


  We've found a bug for you!
  /Users/drupadkumar.singh/Repo/rescript-euler-dashboard/src/screens/switchboard/AlertManager/AlertManagerTypes.res

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

FAILED: cannot make progress due to previous errors.

I have used decco ppx in lot of my types to get these encoders/decoders. I have never used ppxlib so have very little knowledge around ppx syntax. I need to somehow check the AST maybe to find out which function is actually curried here and fix that for this conversion. Or is this new version going to break ppx libraries entirely

 @decco
  type queryConfig = {
    comparator: Common.comparator,
    query: string,
    threshold: string,
    time_range: string,
  }

I think you should migrate to GitHub - green-labs/ppx_spice: ReScript PPX which generates the JSON (de)serializers, since that one is the spiritual successor of decco for ReScript.
Never used it personally, but I bet @moondaddi is happy to confirm.

1 Like

Is there any reverse syntax which allows using curried mode in some files via @@curried annotation or something similar

That library was last updated last year, I don’t think it’ll work fine with rescript@11

this is the most current version, only 3 months old
And it’s explicitly updated for ReScript 11

1 Like

There is also rescript-schema which is very similar to decco when used with the ppx. I’ve been using that with ReScript 11 and can recommend.

4 Likes
module Common = {
  @spice
  type comparator = string // for example
}

@spice
type queryConfig = {
  comparator: Common.comparator,
  query: string,
  threshold: string,
  time_range: string,
}

You can configure the mode in the rescript.json for ReScript v11

// uncurried
"ppx-flags": [
  ...,
  [
      "@greenlabs/ppx-spice/ppx",
      "-uncurried"
    ],
  ...
]

// curried
"ppx-flags": [
  ...,
  "@greenlabs/ppx-spice/ppx"
  ...,
]
2 Likes

Make sure installing the latest version 0.2.1-rc.2

1 Like