I have the following method
def show[E: Writes, T: Writes](block: RequestWithUser[AnyContent] => Either[E, T]): Action[AnyContent] = { withErr(block) }
which I use like this from the controller:
def show(id: Long) = CrudAuthAction.show { request => IdeaType.findByIdWithErr(id) }
And I want the request method to be optional, so I defined a different signature for the same method:
def show[E: Writes, T: Writes](block: => Either[E, T]): Action[AnyContent] = { withErr(request => block) }
And it works fine, I can omit the query parameter
But when I try to do the same with this other method
def list[T: Writes](block: RequestWithUser[AnyContent] => T): Action[AnyContent] = { fromRequest(block) } def list[T: Writes](block: => T): Action[AnyContent] = { fromRequest(request => block) }
When I want to use it as follows:
def list = CrudAuthAction.list { request => IdeaType.find(request.queryString) }
he tells me that the request is missing a parameter type, and I must specify it as follows:
def list = CrudAuthAction.list { request: RequestWithUser[AnyContent] =>
I do not see what is different from the first case, but scala cannot seem like it is requesting the correct request type ...
The only difference I see is that in the first case, the block returns A [E, T], but in the second case only the general T is returned ...