How to use context parameters with accumulating er...
# arrow
u
How to use context parameters with accumulating errors? I'm probably missing something here... I have two functions
Copy code
context(_: Raise<MyError>)
fun parseA(in: String): A
and
Copy code
context(_: Raise<MyError>)
fun parseB(in: String):B
I'd like to combine those as follows:
Copy code
context(_: RaiseAccumulate<MyError>)
fun parseC(in: String):C = zipOrAccumulate( 
  { parseA(in) },
  { parseB(in) },
) { a, b -> C(a, b) }
This results in a compiler error because receiver type mismatch. What am I missing?
y
Maybe you're missing an import?
Copy code
import arrow.core.raise.context.zipOrAccumulate
u
The problem seems to arise because of the `Raise`context for the elementary functions and the
RaiseAccumulate
context for the accumulating function.
y
Oh yeah, of course! You cna use
withNel
for that
👍 1