Make your programs Free
Pawel Szulc
@rabbitonweb
Free Monads!
Free[S, A]
Free[S, A]
This is the program
Free[S, A]
This is the language
Free[S, A]
This is the type of a value it will produce (once it is run)
Let’s see it in action!
(aka Demo)
https://github.com/rabbitonweb/make-your-programs-free
Usage of Scalaz’s Task
class Task[+A](val get: Future[Throwable / A]) { .. }
Usage of Scalaz’s Task
class Task[+A](val get: Future[Throwable / A]) { .. }
def foo(input: Int): Future[String]
Usage of Scalaz’s Task
class Task[+A](val get: Future[Throwable / A]) { .. }
def foo(input: Int): Future[String]
def bar(intput: Int): Task[String]
Usage of Scalaz’s Task
class Task[+A](val get: Future[Throwable / A]) { .. }
def foo(input: Int): Future[String]
def bar(intput: Int): Task[String]
val f: Future[String] = foo(10)
val b: Task[String] = bar(20)
val s1: String = b.unsafePerformSync
Let’s see it in action!
(aka Demo)
https://github.com/rabbitonweb/make-your-programs-free
Input - Output
Logging
Can we have both?
Manipulate Account
Introducing: low level
machinery
Compiling down to
lower-level language
Free[S, A]
But I want to see a real world example!
https://github.com/quasar-analytics/quasar
Thank you for watching!
Pawel Szulc
@rabbitonweb
Thank you for watching!
Pawel Szulc
@rabbitonweb
paul.szulc@gmail.com
Thank you for watching!
Pawel Szulc
@rabbitonweb
paul.szulc@gmail.com
http://rabbitonweb.com
Thank you for watching!
Pawel Szulc
@rabbitonweb
paul.szulc@gmail.com
http://rabbitonweb.com
https://github.com/rabbitonweb/make-your-programs-free

Make your programs Free