Hi there,
coming from languages with sum types, is such a punishment to use java. We actually wrote handmade ADTs like your library is generating. I really like how less you have to type and what is generated for you. ❤️
This library already generates the
isX(): Boolean and asX(): X
we added in our hand wrote code a asSafeX(): Optional<X> method. This is more typesafe and could actually replace both methods
isX() is asSafeX().isPresent() and
asX() is asSafeX().get()
but you could also do typesafe stuff like asSafeX().map(x=>2*x).orElse(42)
Can you image to add this method?
Cheers Thomas
Hi there,
coming from languages with sum types, is such a punishment to use java. We actually wrote handmade ADTs like your library is generating. I really like how less you have to type and what is generated for you. ❤️
This library already generates the
isX(): BooleanandasX(): Xwe added in our hand wrote code a
asSafeX(): Optional<X>method. This is more typesafe and could actually replace both methodsisX()isasSafeX().isPresent()andasX()isasSafeX().get()but you could also do typesafe stuff like
asSafeX().map(x=>2*x).orElse(42)Can you image to add this method?
Cheers Thomas