EJZIO

ZIO for the Enterprise

ScalaConf Russia / Moscow / 2019

Limits of ZIO adoption

  • Scala
  • FP
  • Humans

Break the limits!

Scala developer

Java developer

The answer is...

JAVA

meet...

EJZIO

Enterprise-ready ZIO for Java

first-class Java support for ZIO

Familiar and easy syntax:


final ZIO<> hello = new ZioFactory.Builder
    .withErrorType(MyCustomError.getClass)
    .fromFuture(CompletableFuture.applyAsync( () -> doWork()))
    .build(Integer.getClass)
			  	

For-comprehensions for Java


public class ZIO {
	public static ZIO1<E1,A1,T1,R> zfor(ZIO<E1,A1,T1> a1, ZIO.Yield1<T1,R> yield);
	public static ZIO2<E1,A1,T1,E2,A2,T2,R> zfor(ZIO<E1,A1,T1> a1, ZIO<E2,A2,T2> a2, ZIO.Yield2<T1,T2,R> yield);
	public static ZIO3<E1,A1,T1,E2,A2,T2,E3,A3,T3,R> zfor(ZIO<E,A,T> a1, ZIO<E,A,T> a2, ZIO<E,A,T> a3, ZIO.Yield3<T1,T2,T3,R> yield);
	...
	public static ZIO22<E1,A1,T1,E2,A2,T2,E3,A3,T3,E4,A4,T4,E5,A5,T5,E6,A6,T6,R> zfor(ZIO<E,A,T> a1, ZIO<E,A,T> a2, ZIO<E,A,T> a3, ZIO.Yield3<T1,T2,T3,R> yield);
}
			  	

Integer result = zfor( 
    a1 = ZIOFactory.Builder.pure(1),
    a2 = ZIOFactory.Builder.fromFuture(CompletableFuture.applyAsync( () -> getInt())),
    new ZIO.Yield2<Integer,Integer>( (a1, a2) -> a1 + a2 )
)
			  	

ZIO3<E1,A1,T1,E2,A2,T2,E3,A3,T3,R>

New level of type-safety!

Spring-boot: @ZIO annotation

compile-time dependency injection

Towards a functional Java

ZCALA

a scala compiler fork with better FP support!

Zcala: better HKT syntax

_ is not readable!



F[_,_] -> F[,]

emoji support!

end!