John Herrlin
01/31/2023, 10:38 AMList<Either<Error,Success>> into Either<Error, List<Success>> ?stojan
01/31/2023, 10:47 AMJohn Herrlin
01/31/2023, 10:52 AMWilerson Oliveira
01/31/2023, 10:52 AMstojan
01/31/2023, 10:59 AMWilerson Oliveira
01/31/2023, 11:03 AMstojan
01/31/2023, 11:04 AMtraverse πsimon.vergauwen
01/31/2023, 12:55 PMeither { map { it.bind() } } if you're not already within either { } and otherwise just map { it.bind() }.simon.vergauwen
01/31/2023, 12:56 PMList<Input> and it would result in something like input.map { transform(it).bind() } if you're inside either { }.simon.vergauwen
01/31/2023, 12:57 PMmap { it.bind() } is sequence and map { transform(it).bind() } is traverse.stojan
01/31/2023, 12:57 PMmapNotNull {} and this is similar π
also mapNotNull is basically map {}.filterNotNull() but it's common enoughsimon.vergauwen
01/31/2023, 1:00 PMmapNotNull makes me think of mapNotLeft but that's a horrible name π The semantics of mapNotNull are quite different though, since it doesn't short-circuit but it filters.stojan
01/31/2023, 1:01 PMsimon.vergauwen
01/31/2023, 1:01 PMtraverse for null != mapNotNull otherwise mapNotNull should return List<A>?stojan
01/31/2023, 1:03 PMsimon.vergauwen
01/31/2023, 1:05 PMeither { } without affecting performance and that way it'll be easy to understand on jump to definition.
I think flattening Validated with Either will give most benefit in API surface already. Albeit traverse for Validated will be now named mapOrAccumulate with bind() syntax...simon.vergauwen
01/31/2023, 1:05 PMstojan
01/31/2023, 1:08 PMValidated merging with Either , I think I was part of the initial discussion here on slack..... IMHO that's a very good thing.... killing some legacy because of typeclasses π
I am not familiar with the specifics tho πsimon.vergauwen
01/31/2023, 1:14 PMdnowak
01/31/2023, 7:03 PMtraverse or sequence in the code. If you replace such functions with DSL, I must βparseβ DSL to determine what the code does. Is it traverse or sequence, or maybe some custom code? Or someone used an explicit parameter name, and instead of it there is a document or whatever else.
The code should be easy to read. DSL does not help with that.
From a newbieβs perspective, the DSL may seem a better solution, as there is less to learn.
But for someone with more experience with current Arrow or FP the DSL may be an unnecessary overhead where a single word would suffice.
The whole idea of programming is to hide details under a well-named abstraction.simon.vergauwen
01/31/2023, 7:10 PMtraverse and sequence for Either. This feedback is very helpful! Thank you πsimon.vergauwen
01/31/2023, 7:11 PMThe code should be easy to read. DSL does not help with that.I don't completely agree with this though. Kotlin offers many things in shape of DSL that tremendously help with readability. For example the usage of smart-casting, but to be fair it's something I initially also had to get used to being familiar with traditional FP style APIs. I think there is a very fine line where DSL drastically improves things, but being too drastic in removing APIs is also counter productive. That's why all this feedback is very crucial to making the right decisions.
simon.vergauwen
01/31/2023, 7:13 PM@Deprecated than to break in 2.x.x and re-add it.Kristian Nedrevold
01/31/2023, 7:25 PMKristian Nedrevold
01/31/2023, 7:26 PMKristian Nedrevold
01/31/2023, 7:27 PMsimon.vergauwen
02/01/2023, 8:10 AMsimon.vergauwen
02/01/2023, 8:12 AMcontext(Raise<E>) instead of Either, and that would just make it map { transform(it) } without bind... which is the far superior pattern, but we'll see how mainstream context(Raise<E>) will get.
Sticking to old patterns is also not a good thing perse, since FP was not able to get main spread usage that way. I'm giving a talk this weekend about what I think makes FP great in Kotlin. It's also live streamed and recorded. https://events.xebia.com/functional-fun-in-kotlinKristian Nedrevold
02/01/2023, 8:23 AMstojan
02/01/2023, 8:24 AMsimon.vergauwen
02/01/2023, 8:25 AMsimon.vergauwen
02/01/2023, 8:25 AMKristian Nedrevold
02/01/2023, 8:28 AMKristian Nedrevold
02/01/2023, 8:30 AMstojan
02/01/2023, 8:31 AMP A
02/01/2023, 8:34 AMKristian Nedrevold
02/01/2023, 8:38 AMsimon.vergauwen
02/01/2023, 8:39 AMsimon.vergauwen
02/01/2023, 8:39 AMsimon.vergauwen
02/01/2023, 8:40 AMit's the compiler implementation that is notWhat I mean with this is to make it available on Native & JS. That's why it's currently JVM only.
Kristian Nedrevold
02/01/2023, 8:40 AMKristian Nedrevold
02/01/2023, 8:44 AMKristian Nedrevold
02/01/2023, 8:45 AM