FunPlay is a collection of tools to aid purely functional programming with Play framework.
Current tools include:
- Typesafe action builders
- Purely functional controllers
- Scalaz typeclass instances
- ...
Your service as a function:
type Service[I,O] = I => Future[O]
Then, we want to build a Play controller for it:
val service1: Service[I,O]
val controller1 = Action.async{
....
}
Modularise the work: translation back and forth from HTTP request/response to Service I/O. Provide defaults whenever applicable.
Now, we defined our effects and our service is no longer a Future-based service, but a Kleisly.
type Service[F[_], I, O] = I => F[O]
When building our controller, we need more information: the interpreter for F
Some instances for common Scalaz typeclasses.