-
Notifications
You must be signed in to change notification settings - Fork 11
Functionality to make Read a MonadError #11
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
base: master
Are you sure you want to change the base?
Conversation
wennergr
commented
Jul 20, 2018
- Error handler for Read
- Monadic combinators for Read
- Constant constructor for Read
- Verification of MonadError laws for Read
* Error handler for Read * Monadic combinators for Read * Constant constructor * Verification of MonadError laws
Codecov Report
@@ Coverage Diff @@
## master #11 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 7 7
Lines 99 126 +27
Branches 1 1
=====================================
+ Hits 99 126 +27
Continue to review full report at Codecov.
|
|
I was reading a book about cats recently and I have been thinking about adding those laws methods. |
|
If you would rewrite I do not think End User would actually need to use (transform) |
|
Hey, thanks for your reply. Can't really speak for you but I'm using them for sure!. It allows me to use the same pattern as with our JSON parser circe. Support for error handling seems like a good idea as well (and you can now write the One trival example: // Functor (we often use wrapped value classes)
case class UserId(repr: Long) extends AnyVal
object UserId {
implicit val read: Read[UserId] = longRead map UserId.apply
}I agree that the Encoder/Decoder vs Read/Write is a bit odd. The problem is a bit more complicated thou since you can't rely on the applicative (actually semigroupal) to load data into case classes. You will quickly hit the Scala 22 limit problem (Tuple22 and the mapN function on it). I also care less about the flexibility of Encoder/Decoder as I don't need to intergrate with them much I'm interested in hearing your future ideas with the library. I do have some ideas as well if you are interested. (not as part of the PR thou) ;) Finally, Feel free to not go this path as well! It not a big deal for me to define these instances in my own code. Cheers ;) |
|
Sorry about the delay, got busy with other tasks. I like the overall idea, but I am wondering why didn't you extend |