Pratical eff

Post on 24-Jan-2017

28 views 0 download

transcript

Eric Torreborre

Practical Eff monad

Doing it for real

About Zalando

Brand solutions

Article service

Artic

le s

ervic

e

Zeos

products

business-partners

stocks

59.95 € 10 items

How to deal?

Components!

DI?

Cake?

Guice?

Spring?

Radical

Constructor injection!

Grafter

HttpServer

Routes

Services

Clients

PriceHttpService

PriceHttp4sService

Always one default

In a library?

readerall the

way down!

Unit testing?

Integration testing?

HttpServer

Routes

Services

Clients

HttpServer

Routes

Services

Clients

Tree rewriting!

Kiama

Singleton?

HttpServer

Routes

Services

Clients

HttpServer

Routes

Services

Clients

Stay lazy!

Start order?

lazy

reader

rewrite

start

Eff please!

Out of the box

Reader

Eval

Async

State

ThrowableEither

Writer

Article service

FlowId

HttpServer

Routes

Services

Clients

flowId

flowId

flowId

flowId

Logged

Applicative

Concurrent execution

MasterData PriceService

Inventory

Async

Eff in Eff!

Future Monix

No applicative for-comprehension

FlowId

Logged

Async

Eval

Mitsaeks we made

Errors

3 possibilities

1 error style per layer

Translation between layers

HttpServer

Routes

Services

Clients

Client level

Service level

Service level

Service level

Local Effects!

Everything is a (Free) DSL?

Make price request

request

[PriceRequest]

[PriceRequest]

response

Interpret request[PriceRequest, Async]

[Async]

Get price

price

[Async]

[Async]

Time: effect or component?

Get status

status

[Eval]

now?[Eval]

now

Get status

status

[Eval]

now?[Eval]

now FreezedTime

Get status

status

[Eval, Timed]

runFreezedTime(status)[Eval]

Recap

More Applicative Goodies!

Batching

Translation client

Inventory

Translation client

Inventory

Audited

Logs Database Event Bus

Rate limiting

Create

Intercept

Interpret