That's a Scala limitation - it's not possible to introduce two separate 
implicit values in one line AFAIK.
When you say `implicit ...` it makes that one value implicit (the tuple), not 
both of these - it has no way of looking inside the tuple basically.

Devs on scala-internals may have more say on this topic, but I don't recall 
this to be worked on.

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe

On 30 May 2015 at 09:16:10, Giovanni Alberto Caporaletti (paradi...@gmail.com) 
wrote:

Thanks Konrad,
I already have a lot of custom directives, but what I was wondering is if 
there's a way to make them both implicit.
Maybe this is a more general scala question, like: how can I make all the 
parameters of a lambda implicit, because "{ implicit x=> ... }" works while "{ 
implicit (x,y) => ...}" doesn't .

Cheers
G


On Friday, 29 May 2015 19:07:08 UTC+2, Konrad Malawski wrote:
Hi Giovanni,
Firstly, sorry we don't have docs on this yet, but they are coming soon! ( 
check this with a higher version number soon 
http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-M2/scala/http/custom-directives.html
 )

Both these directives are implemented in terms of the extract directrive,
by digging a bit through the sources you'll notice the patterns :-)

Something among the lines:

def extractBoth: Directive[(ExecutionContext, FlowMaterializer)] =
  textract(rc => (rc.executionContext, rc.flowMaterializer))

  extractBoth { (ec, mat) =>
    // ec.execute()
    // mat.materialize()
  }


Should do the trick.
Happy hakking!

On Mon, May 18, 2015 at 8:10 PM, Giovanni Alberto Caporaletti 
<para...@gmail.com> wrote:
Hi everyone,

I often need to have both the materializer and the execution context in scope 
in my routes.

Is there a more compact way of doing this?

extractFlowMaterializer { implicit mat =>
  extractExecutionContext { implicit ec =>

or

extractFlowMaterializer { implicit mat =>
  implicit val ec = mat.executionContext


I tried something like (extractFlowMaterializer & extractExecutionContext) { 
implicit (mat, val) => ... but it doesn't work



thanks
G
--
>>>>>>>>>> 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+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Cheers,
Konrad 'ktoso' Malawski
Akka @ Typesafe
--
>>>>>>>>>> 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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to