I see Union like anonymous sealed class
# arrow
t
I see Union like anonymous sealed class
👍🏾 1
c
So you would use
Either<UnionN<Error1, Error2, Error3...>, A> ?
t
yep, I like more that approach, also could be in the right side of the Either
Either will give you monad behavior (short-circuit, flatmap….) and model your “data” as untagged ADT
j
@thanerian What do you mean by "untagged ADT"?
t
an ADT in kotlin is modeled via sealed classes and should have a “tag” the name of the hiearchy,
sealed class Tag
and any number of branches
data class foo: Tag()
, Union Types are also ADT, allows you to have any number of branches, but without a Tag , that is why I call them untagged ADT
j
Ah, I see. Thanks for explaining @thanerian!
@thanerian Is "untagged ADT" a commonly-understood term in FP?
t
I'm not an expert, but I think yea
👍🏾 1