<@U619WRNJE> expanding on what <@U0RM4EPC7> said t...
# arrow
r
@ersin_ertan expanding on what @simon.vergauwen said that is a polymorphic function that can compute over any higher kind for which a
MonadError<F, NukeException>
exist. In the case of
Option
it can't provide such an instance because there is no way to store the
NukeException
, since
None
which is the unbiased case can't store that error. Same for
Try
since it's
Failure
it's fixed to
Throwable
and
NukeException
is not in the
Throwable
hierarchy. The only choice here is
Either
which is parametric in it's
Left
case.
attack
may be invoked in two different ways:https://gist.github.com/raulraja/40ac0d0f03f4a1a85f6d249464f30a95
e
@raulraja Still getting a compile error. Is
monadError
a variable or is it suppose to be
ME.buindingE
? https://gist.github.com/ersin-ertan/ec0674dc1160158d3eaccc6b2eaf7374
r
s
Haha omg it took me a good while to spot the difference.
@ersin_ertan perhaps it can save you some time.
bindingE
is only available on
MonadError<F, Throwable>
as it catches any exceptions thrown within the
bindingE
block and then calls
raiseError(e: Throwable)
to model the thrown exception is correctly.
👍 1
@raulraja correct my if I am wrong.
r
that is correct but here in this context if you wanted to catch runtime exceptions you could still use
ME.catch(...)
👍 1
which automatically calls
raiseError
underneath if the computation fails.
But yeah
bindingE
is only for general exceptions.
e
Great, is something that should be reflected in the docs? If so, I can do that.
👍 1
r
@ersin_ertan any improvements to the current state of the docs is welcomed!