Hi all :wave: Reading the <typed errors> document...
# arrow
a
Hi all 👋 Reading the typed errors document, I adopted it for my personal projects, but the API feels weird on first glance. I'm assuming "multiple context receivers" is what's missing, because
Raise
seems to be currently conflicting with other stuff in Kotlin (e.g., if you use Raise as the receiver type, you can't use anything else). I have a validation function that I struggled to describe, I'm unsure if this is OK, or if there's any way I can improve it — trying to collect multiple validation errors from multiple fields, in order to produce a nice error message: https://gist.github.com/alexandru/d5d6042278452d4817715b614a72be27 Btw, I struggled for more than half an hour with
zipAndAccumulate
because I imported the wrong one:
Copy code
// Yikes, this isn't it
import arrow.core.Either.Companion.zipOrAccumulate
Documentation could be improved with some explicit imports, as IntellIJ IDEA can misfire. Whole library is looking good, have made great use of it for managing resources.
👋 3
s
Hey Alexandru, Ouch, the examples should be linked. All the examples from the documentation exist as actual Kotlin files in the arrow-website repo. And KotlinX-knit can automatically update the references. I created an issue, https://github.com/arrow-kt/arrow-website/issues/187. Yes, multiple receivers will vastly improve this pattern.. The documentation also briefly discuss the current trade-offs but TL;DR use
Either
if you cannot (or do not) want to use
Raise
as an extension receiver. The trade-off is having to use
bind
.
Only two nits/questions on your snippet. Why is the
right
necessary in the
zipOrAccumulate
? And the
return
shouldn’t be there. Is that why the
right
is needed? 🤔 Super excited to see you venture into Arrow 😁 If been following you’re work since I’ve originally started learning FP in Scala. If you have any feedback I’d love to hear it! 🙏
a
Hey @simon.vergauwen, Thanks for the reply. It's super interesting what you're doing with Arrow, a fresh perspective. Just watched your presentation on Arrow 2.0 from KotlinConf, good stuff.