Skip to content

Commit

Permalink
remove uncurry annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
zth committed Feb 14, 2024
1 parent c17f52c commit 4deff17
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 27 deletions.
8 changes: 4 additions & 4 deletions src/Core__Promise.res
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
type t<+'a> = promise<'a>

@new
external make: ((@uncurry 'a => unit, 'e => unit) => unit) => t<'a> = "Promise"
external make: (('a => unit, 'e => unit) => unit) => t<'a> = "Promise"

@val @scope("Promise")
external resolve: 'a => t<'a> = "resolve"

@send external then: (t<'a>, @uncurry 'a => t<'b>) => t<'b> = "then"
@send external then: (t<'a>, 'a => t<'b>) => t<'b> = "then"

@send
external thenResolve: (t<'a>, @uncurry 'a => 'b) => t<'b> = "then"
external thenResolve: (t<'a>, 'a => 'b) => t<'b> = "then"

@send external finally: (t<'a>, unit => unit) => t<'a> = "finally"

Expand All @@ -35,7 +35,7 @@ external all5: ((t<'a>, t<'b>, t<'c>, t<'d>, t<'e>)) => t<('a, 'b, 'c, 'd, 'e)>
external all6: ((t<'a>, t<'b>, t<'c>, t<'d>, t<'e>, t<'f>)) => t<('a, 'b, 'c, 'd, 'e, 'f)> = "all"

@send
external _catch: (t<'a>, @uncurry exn => t<'a>) => t<'a> = "catch"
external _catch: (t<'a>, exn => t<'a>) => t<'a> = "catch"

let catch = (promise: promise<'a>, callback: exn => promise<'a>): promise<'a> => {
_catch(promise, err => {
Expand Down
6 changes: 3 additions & 3 deletions src/Core__Promise.resi
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Promise.make((resolve, reject) => {
```
*/
@new
external make: ((@uncurry 'a => unit, 'e => unit) => unit) => t<'a> = "Promise"
external make: (('a => unit, 'e => unit) => unit) => t<'a> = "Promise"

/**
`catch(promise, errorCallback)` registers an exception handler in a promise chain.
Expand Down Expand Up @@ -139,7 +139,7 @@ Promise.resolve(5)
```
*/
@send
external then: (t<'a>, @uncurry 'a => t<'b>) => t<'b> = "then"
external then: (t<'a>, 'a => t<'b>) => t<'b> = "then"

/**
`thenResolve(promise, callback)` converts an encapsulated value of a promise
Expand All @@ -163,7 +163,7 @@ In case you want to return another promise in your `callback`, consider using
`then` instead.
*/
@send
external thenResolve: (t<'a>, @uncurry 'a => 'b) => t<'b> = "then"
external thenResolve: (t<'a>, 'a => 'b) => t<'b> = "then"

/**
`finally(promise, callback)` is used to execute a function that is called no
Expand Down
14 changes: 4 additions & 10 deletions src/Core__String.res
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,29 @@ type normalizeForm = [#NFC | #NFD | #NFKC | #NFKD]
external unsafeReplaceRegExpBy0: (
string,
Core__RegExp.t,
(@uncurry ~match: string, ~offset: int, ~input: string) => string,
(~match: string, ~offset: int, ~input: string) => string,
) => string = "replace"

@send
external unsafeReplaceRegExpBy1: (
string,
Core__RegExp.t,
(@uncurry ~match: string, ~group1: string, ~offset: int, ~input: string) => string,
(~match: string, ~group1: string, ~offset: int, ~input: string) => string,
) => string = "replace"

@send
external unsafeReplaceRegExpBy2: (
string,
Core__RegExp.t,
(
@uncurry ~match: string,
~group1: string,
~group2: string,
~offset: int,
~input: string,
) => string,
(~match: string, ~group1: string, ~group2: string, ~offset: int, ~input: string) => string,
) => string = "replace"

@send
external unsafeReplaceRegExpBy3: (
string,
Core__RegExp.t,
(
@uncurry ~match: string,
~match: string,
~group1: string,
~group2: string,
~group3: string,
Expand Down
14 changes: 4 additions & 10 deletions src/Core__String.resi
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ String.unsafeReplaceRegExpBy0(str, re, matchFn) == "bEAUtIfUl vOwEls"
external unsafeReplaceRegExpBy0: (
string,
Core__RegExp.t,
(@uncurry ~match: string, ~offset: int, ~input: string) => string,
(~match: string, ~offset: int, ~input: string) => string,
) => string = "replace"

/**
Expand All @@ -602,7 +602,7 @@ String.unsafeReplaceRegExpBy1(str, re, matchFn) == "Jony is 41"
external unsafeReplaceRegExpBy1: (
string,
Core__RegExp.t,
(@uncurry ~match: string, ~group1: string, ~offset: int, ~input: string) => string,
(~match: string, ~group1: string, ~offset: int, ~input: string) => string,
) => string = "replace"

/**
Expand All @@ -628,13 +628,7 @@ String.unsafeReplaceRegExpBy2(str, re, matchFn) == "42"
external unsafeReplaceRegExpBy2: (
string,
Core__RegExp.t,
(
@uncurry ~match: string,
~group1: string,
~group2: string,
~offset: int,
~input: string,
) => string,
(~match: string, ~group1: string, ~group2: string, ~offset: int, ~input: string) => string,
) => string = "replace"

/**
Expand All @@ -647,7 +641,7 @@ external unsafeReplaceRegExpBy3: (
string,
Core__RegExp.t,
(
@uncurry ~match: string,
~match: string,
~group1: string,
~group2: string,
~group3: string,
Expand Down

0 comments on commit 4deff17

Please sign in to comment.