Breno Ferreira
August 08, 2014

# Fun with Types

Talk given at The Developers Conference in Sao Paulo, 2014 in the Scala track

August 08, 2014

## Transcript

3. ### FOR EXAMPLE d e f d i v ( x

: I n t , y : I n t ) = x / y

)

10. ### FOR EXAMPLE: v a l s j o b s

: ( ) = > S t r i n g s j o b s ( ) / / : " A p p l e I " s j o b s ( ) / / : " A p p l e I I " s j o b s ( ) / / : " M a c i n t o s h ! " s j o b s ( ) / / : " ✗"

]
12. ### FOR EXAMPLE: v a l s j o b s

: ( ) = > S t r i n g s j o b s ( ) / / : " i P h o n e " s j o b s ( ) / / : " i P a d " s j o b s ( ) / / : " i C l o u d " s j o b s ( ) / / : " ✝"
13. ### MAKING EVERYTHING EXPLICIT: ( ) = > T r y

[ O p t i o n [ T ] ]
14. ### WHAT ABOUT A GETTER OF GETTERS? ( ) = >

( ) = > T r y [ O p t i o n [ T ] ]
15. ### EXTRACT TO INTERFACE t r a i t I t

e r a b l e [ T ] { g e t I t e r a t o r : I t e r a t o r [ T ] } t r a i t I t e r a t o r [ T ] { h a s N e x t : B o o l e a n n e x t : T }

]
18. ### ASYNC GETTER ( ( T r y [ T ]

) = > ( ) ) = > ( )
19. ### BASICALLY, A FUTURE t r a i t F u

t u r e [ T ] { o n S u c c e s s : T = > ( ) o n F a i l u r e : E x c e p t i o n = > ( ) }

21. ### EASY: ( ( T r y [ I t e

r a b l e [ T ] ] ) = > ( ) ) = > ( )
22. ### BETTER: ( ( T r y [ O p t

i o n [ T ] ] ) = > ( ) ) = > ( )
23. ### OBSERVABLE/OBSERVER t r a i t O b s e

r v a b l e [ T ] { s u b s c r i b e ( o b s e r v e r : O b s e r v e r [ T ] ) } t r a i t O b s e r v e r [ T ] { o n N e x t ( v a l u e : T ) o n E r r o r ( e r r o r : E x c e p t i o n ) o n C o m p l e t e d ( ) }
24. ### FOUR BASIC EFFECTS IN COMPUTING: One Many Sync T /

Option[T] Iterable[T] Async Future[T] Observable[T]