Skip to content

External bindings use currying when the signature is not inlined #7002

Open
@JonoPrest

Description

@JonoPrest

See playground:

https://rescript-lang.org/try?version=v11.1.3&code=AIWw9gJgrgNgpgCgEQgJ4FoCWA7ALumTAIyQEoACOAD1zgCdsBDGcxiCALnIR1wBpyvCgF4AfILzlh5JGwhIAUAtyoADnAm4A8qqndeAoVPG8FoSLEQoMvAsTKUa9JiwDOUIl1469SdySV4XFZ2AEY9RmNWdFE5BFDSBSDyf3DpSLFo0X94xKA

@module("my-int-lib") external add: (int, int) => int = "add"

type intOp = (int, int) => int
@module("my-int-lib") external sub: intOp = "sub"

let add1 = a => a->add(1)
let sub1 = a => a->sub(1)

compiles to:

// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Curry from "./stdlib/curry.js";
import * as MyIntLib from "my-int-lib";

function add1(a) {
  return MyIntLib.add(a, 1);
}

function sub1(a) {
  return Curry._2(MyIntLib.sub, a, 1);
}

export {
  add1 ,
  sub1 ,
}
/* my-int-lib Not a pure module */

Where add1 is applied without currying and sub1 is applied with currying and the only difference is passing a signature vs inlining it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions