-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handling of duplicate keys in Object$prototype$concat #48
Comments
but it is more aligned with Object.assign Object.assign({ a: 1 }, { a: 2 }) // { a: 2 } |
It depends on whether you want Z.concat({x: 1, y: 1}, {y: 2, z: 2}) === ({x: 1, y: 1})['fantasy-land/concat']({y: 2, z: 2}) or not. It's somewhat related to the ordering disputes in sanctuary-js/sanctuary#239 |
Would you like to chime in here, @JAForbes? |
here are couple snippets from index.js. in this ones appropriate FL method is invoked on last argument (data last) function reduce(f, x, foldable) {
return Foldable.methods.reduce(foldable)(f, x);
}
function map(f, functor) {
return Functor.methods.map(functor)(f);
}
function chain(f, chain_) {
return Chain.methods.chain(chain_)(f);
} In case of this ones it's hard to say that which one is data as both of them are dataish. function concat(x, y) {
return Semigroup.methods.concat(x)(y);
}
function equals(x, y) {
... Setoid.methods.equals(x)(y) ...
}
function alt(x, y) {
return Alt.methods.alt(x)(y);
}
function of(typeRep, x) {
return Applicative.methods.of(typeRep)(x);
} So the issue is not in |
@gabejohnson, I'm not at all concerned with the relationship between the order of arguments to a
I don't think that's correct. See #49. |
In haskell |
I'd personally prefer the left argument for this function and several others (including But I think that's because I often use But I can also see someone else wanting And this is why I bring up Currently // overwrite if the 2nd arg is Just
var defaultVal = S.alt( S.Just('default value') )
defaultVal( S.Just('desired value') )
//=> Just('default value')
// :( The other day in gitter I was saying the current argument order isn't conducive for point free. But on reflection, its not conducive for point free for my specific use case 😄 . Both styles are useful in specific contexts and inconvenient in others. I'd rather the entire library is consistent. So unless we're going to be left biased for other functions, I think right biased is ( unfortunately for me ) the way to go. But if we did switch to left biased, would that change the behavior of e.g. |
You would need to use placeholder in Purescript too (or flip)
|
Let's stick with the current behaviour for the time being. As it's not clear that one approach is better than the other it's best to leave things as they are. We can revisit this issue if new information comes to light. |
Sanctuary:
Haskell:
We didn't discuss this behaviour in #2 as far as I can see; I think we diverged from Haskell's behaviour unintentionally.
/cc @puffnfresh
The text was updated successfully, but these errors were encountered: