Comments (4)
You can even simplify it down to this:
module Bla: {
let array: ('a => 'b, Js.Array.t<'a>) => Js.Array.t<'b>
} = {
let array = (encoder, arr) => Js.Array.map(encoder, arr)
}
I think the issue comes from the fact that Js.Array.map
is curried and expects its mapper function to be curried, the error message is right, it should just mention the difference in the curried state of the function between expected and actual. Basically some cases (especially when the faulty function is a parameter of a function) is not fixed by #6414. Given we're sunsetting Js lib in v12, I'm not sure we have to do anything here.
The right error message should be like this:
Signature mismatch:
...
Values do not match:
let array: ('a => 'b (curried), Js.Array.t<'a>) => Js.Array.t<'b>
is not included in
let array: ('a => 'b (uncurried), Js.Array.t<'a>) => Js.Array.t<'b>
playground.res:2:3-57: Expected declaration
playground.res:4:7-11: Actual declaration
from rescript-compiler.
I am trying to wrap my brain around this, but if we have a function with one argument what is the difference between curried and uncurried. Is it that the function is potentially partially applied?
And I thought the stdlib would be all uncurried with the uncurried setting turned on. How would I know what is curried vs uncurried? Isn't the switch just compiling everything as uncurried? I think it's strange that there is a possibility of anything being curried when the flag is turned on - I think it's way more consistent that this is a system-wide thing.
About deprecating Js
. Will that remove the possibility of directly using functions in the Js stdlib, or is / will that be included in Core?
from rescript-compiler.
A unary curried function that returns a unary curried function is what's called a binary curried function.
With uncurried, a binary function is another thing.
So curried and uncurried are always different things, whatever the arity.
from rescript-compiler.
A unary curried function that returns a unary curried function is what's called a binary curried function. With uncurried, a binary function is another thing. So curried and uncurried are always different things, whatever the arity.
Understood. I didn't know that the stdlib is still curried in uncurried mode, perhaps we can do something to make this clear? I think it's pretty weird to be honest, why would you want this to be curried?
But at least it would be great to fix the error so that it's clear that the difference is that one function is curried and the other is not. That would make me track down this bug way easier :)
from rescript-compiler.
Related Issues (20)
- GenType Feature Request: Support scoped polymorphic types HOT 2
- Persistent comments in `@as` attribute payload HOT 1
- ReScript force normalizing `-0` to `0` HOT 7
- Casting `infinity` to integer makes value `0` HOT 32
- RFC: Protected value representation HOT 4
- %intoffloat inconsistency
- @deriving(jsConverter) in uncurried mode outputs curried functions HOT 3
- Optimization applied for polymorphic variants, but not for regular variants
- Not helpful error message when doing a typo in labeled arguments
- Rescript formatting unstable and producing semantic deviations for inline functions in pipe chains HOT 1
- Wrong character encoding when using tagged templates HOT 3
- False "unused open" warning HOT 1
- @rescript/core package doesn't have the javascript file HOT 20
- @unboxed should support Js.TypedArray2.ArrayBuffer.t HOT 1
- Uppercase type arguments don't work in inlined records HOT 1
- Add rewatch as an alternative build system to eventually replace bsb
- Add name for Variant Type's constructor arguments HOT 3
- Parentheses incorrectly removed by printer, leading to wrong application of `@uncurry` HOT 1
- Continuous Benchmarking HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rescript-compiler.