I am trying to learn tagless final style to remove concrete monads (ie 
futures) from my code. I have come up with the following strawman 
application (using cats)

class RestaurantRoutes[F[_]: Monad](algebra: RestaurantAlgebra[F]) {
  import algebra._

  def route: Route =
    path("api" / "v4.0" / "restaurant" / IntNumber) { rid =>
      get {
        complete(getRestaurantById(rid).map(_.toString).value)
      }
    }
}

object RestaurantRoutes {
  def apply()(implicit ec: ExecutionContext): 
RestaurantRoutes[FutureOfOption] = {
    import cats.instances.future._

    new RestaurantRoutes(new RestaurantFutureInterpreter())
  }

}

the final type of 

getRestaurantById(rid).map(_.toString).value

is a

Future[Option[String]]

However, I can't seem to figure out to get that marshalled. A marshaller 
exists for all those types, and had I had concrete types intstead of F[_], 
it would have worked. What is the best way to handle this to prevent 
implementation details from leaking in?

Thanks
Jeff

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to