Add doctest example for Op in cats core
This pull request adds a doctest for the Op type in cats.core. The doctest provides a simple usage example demonstrating how Op can be used for contravariant composition.
Thanks for the PR! The CI failed due to a formatting issue, try running scalafmtAll in sbt.
I think it would be nice if it would be possible to explain in the docs why someone may want/need this Op class in the first place. It seems there's no documentation for Op available in Cats whatsoever (or it is not that easy to find).
The class was introduced in #2217 (Add dual categories). As far as I concerned, the "Dual Category" term comes from "Category Theory" and in a nutshell refers to an ability to flip the direction of an arrow.
But it doesn't explain why someone may need this class specifically, because its compose depends on Compose which in turn already has a reversed operation andThen (and also provides handy >>> and <<< operators whereas Op doesn't).
I think it would be nice if it would be possible to explain in the docs why someone may want/need this
Opclass in the first place. It seems there's no documentation forOpavailable in Cats whatsoever (or it is not that easy to find).The class was introduced in #2217 (Add dual categories). As far as I concerned, the "Dual Category" term comes from "Category Theory" and in a nutshell refers to an ability to flip the direction of an arrow.
But it doesn't explain why someone may need this class specifically, because its
composedepends onComposewhich in turn already has a reversed operationandThen(and also provides handy>>>and<<<operators whereasOpdoesn't).
I’ve addressed both feedback, ran scalafmtAll to fix the formatting issues, and added documentation explaining the purpose and usage of the Op class. Kindly take a look when you can and let me know if there’s anything else I should adjust or the next steps. Thank you
Thanks for the PR! The CI failed due to a formatting issue, try running
scalafmtAllin sbt.
I’ve addressed both feedback, ran scalafmtAll to fix the formatting issues, and added documentation explaining the purpose and usage of the Op class. Kindly take a look when you can and let me know if there’s anything else I should adjust or the next steps. Thank you
Hi @satorg,
I just saw that the CI flagged a missing header for Op.scala, but all tests passed successfully. I’ll wait for your feedback before making any further changes, just to be sure I handle it correctly. Please let me know the next step when you can. Thanks!
hello @satorg,
I have made corrections as per the headercheck. Please kindly check and let me know the next step when you can. Thanks!
Hi @satorg, can you please recheck and let me know...Thanks.
Thank you!
You’re welcome! Glad to make the update, thank you for reviewing!