Conversation
modules/core/arrow-core-data/src/test/kotlin/arrow/core/OptionTest.kt
Outdated
Show resolved
Hide resolved
|
Ready to review whenever you're ready to publish :D |
|
Ready to review but I have no idea how to change the PR to Ready to review 😅. Maybe that's because a check hasn't finished yet? |
|
Branch has conflicts, sadly |
|
|
||
| private fun <F> Monoidal<F>.monoidalLeftIdentity(f: (Int) -> Kind<F, Int>, EQ: Eq<Kind<F, Tuple2<Int, Int>>>): Unit = | ||
| forAll(Gen.int().map(f)) { fa: Kind<F, Int> -> | ||
| identity<Int>().product(fa).equalUnderTheLaw(identity(), EQ) |
There was a problem hiding this comment.
I thought this would be equal to fa and not identity!
There was a problem hiding this comment.
Of course you are right, don't know why I implemented it like this. Thanks for pointing that out!
There was a problem hiding this comment.
I think I remember why I did it like this. For example, if we look at ListK:
fa = {1, 2}
fb = {}
The current outcome of fa x fb is {}
{} is also the identity element of ListK, so the outcome within a Monoidal should actually be fa x fb = fa and not fa x fb = {}. This kinda confuses me 😅. It would be great if you could shed some light on this.
There was a problem hiding this comment.
The current outcome of fa x fb is {}
It shouldn't, should it? AFAIK the outcome should be the same as with monoid. That is, the concatenation of both lists.
There was a problem hiding this comment.
I am understanding the Semigroupal type class as an abstraction over the cartesian product so the current behaviour is fa x {} = {}
There was a problem hiding this comment.
But then I still have to change the documentation, right?
| * | ||
| * [identity] returns a specific identity `Kind<F, A>` value for a given type [F] and [A]. | ||
| * | ||
| * Like any other Monoid type class, [Monoidal] also complies with the left and right identity law: |
There was a problem hiding this comment.
Same as in the laws, I thought that the product of empty and a is a, and not empty
|
And in! Thank you again @juliankotrba for working on this :D Hope you had fun |

closes #1323