Re: [akka-user] Spray-json support and FromResponseUnmarshaller

2016-04-24 Thread Konrad Malawski
Hi there, the Unmarshaller type you wrote is correct, however the infrastructure is async in any case – inside withMaterialized you return a Future. implicit val um: Unmarshaller[Future[String], String] = ??? val eventualString: Future[String] = Unmarshal(Future("")).to[String](um,

Re: [akka-user] Spray-json support and FromResponseUnmarshaller

2016-04-23 Thread Edmondo Porcu
I am not sure I understood, would this be blocking? implicit def liftUnmarshaller[A,B](implicit unmarshaller:Unmarshaller[A,B]): Unmarshaller[Future[A],B] = Unmarshaller.withMaterializer( ec => m => a => a.flatMap{ x => unmarshaller.apply(x)(ec,m) }(ec) ) Il giorno venerdì 22 aprile

Re: [akka-user] Spray-json support and FromResponseUnmarshaller

2016-04-22 Thread loempl
> On 22 Apr 2016, at 12:11, Edmondo Porcu > wrote: > > Shouldn't be possible to lift the unmarshaller with an implicit conversion? How? Do you want to block? Heiko -- >> Read the docs: http://akka.io/docs/ >> Check the FAQ:

Re: [akka-user] Spray-json support and FromResponseUnmarshaller

2016-04-22 Thread Edmondo Porcu
Shouldn't be possible to lift the unmarshaller with an implicit conversion? -- >> Read the docs: http://akka.io/docs/ >> Check the FAQ: >> http://doc.akka.io/docs/akka/current/additional/faq.html >> Search the archives:

Re: [akka-user] Spray-json support and FromResponseUnmarshaller

2016-04-20 Thread loempl
Edmondo, You can’t expect unmarshalling to magically unfold the Future you get back. Hence you have to map. Or, to be more precise, you have to flatMap, because unmarshalling returns another Future. ``` responseFuture.flatMap(Unmarshal(_).to[MyClass]) // Notice that you’re still in Future