4 ms·
Here's sum types in scala 3: for x <- fn1() y <- fn2(x) z <- fn3(y) yield z That is both readable and safe, here fn1-fn3 all return
by red_admiral 4y ago
Here's sum types in scala 3:
for
x <- fn1()
y <- fn2(x)
z <- fn3(y)
yield z
That is both readable and safe, here fn1-fn3 all return an Either[Error,T] (the error type has to be common but the success type can vary by function).