Add F[Boolean] syntax#4114
Conversation
|
There's no clear line between the two, but a lot of syntactic convenience goes in mouse instead of cats. Might this fit better there? |
|
I renamed I also removed I will wait a little bit more before deciding to close this and move it to mouse as per Ross suggestion. |
| /** | ||
| * Behaves like `||` but inside the `F` context. | ||
| * | ||
| * Wont evaluate `other` unless this evaluates to `false` |
There was a problem hiding this comment.
This is wrong. Also underscores the need for tests.
There was a problem hiding this comment.
Care to elaborate on why that is wrong?
There was a problem hiding this comment.
Or returns true if either are true. This returns false if the first is true.
There was a problem hiding this comment.
ups... that happens for copypasting code 😅
I am sorry for that.
Yeah, I agree tests are good, but then again how should I test them? The truth tables?
There was a problem hiding this comment.
I would say that for all pairs of inputs Id[Boolean] ops should behave like the normal ops on Boolean, which yes is equivalent to testing the truth table.
| } | ||
|
|
||
| final class MonadBooleanOps[F[_]](private val fa: F[Boolean]) extends AnyVal { | ||
|
|
There was a problem hiding this comment.
She we also add nand, nor, any, all?
There was a problem hiding this comment.
Since it seems that and and or are already niche enough that most folks seem to be against this addition, I doubt there is value on those others.
IMHO, these two are useful enough to be on cats but that is up to the consensus of everyone.
danicheg
left a comment
There was a problem hiding this comment.
I agree with @rossabaker that https://github.com/typelevel/mouse is a probably better place for that syntax. Mouse already has some F[Foo] syntax, so it would be natural to have F[Boolean] syntax too.
|
Moved to mouse based on feedback. |
I know that, in general, we prefer to avoid
F[Boolean]but sometimes we have those values and I personally think this syntax can be very useful.Let me know what you think about this change and the Scaladoc (I couldn't come up with something better).
Also, for testing this change I could only think on a simple truth table but I am not sure if that is a good test.