Created
December 23, 2015 19:37
-
-
Save vkostyukov/0f0157c1e99410227e94 to your computer and use it in GitHub Desktop.
Group Endpoints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> trait Foo1; trait Foo2 | |
defined trait Foo1 | |
defined trait Foo2 | |
scala> trait Bar1; trait Bar2; | |
defined trait Bar1 | |
defined trait Bar2 | |
scala> object Foo { | |
| val endpoints = Endpoint(Ok(new Foo1{})) :+: Endpoint(Ok(new Foo2{})) | |
| } | |
defined object Foo | |
scala> object Bar { | |
| val endpoints = Endpoint(Ok(new Bar1{})) :+: Endpoint(Ok(new Bar2{})) | |
| } | |
defined object Bar | |
scala> val all = Foo.endpoints :+: Bar.endpoints | |
all: io.finch.Endpoint[shapeless.:+:[Foo1,shapeless.:+:[Foo2,shapeless.:+:[Bar1,shapeless.:+:[Bar2,shapeless.CNil]]]]] = ((|)|(|)) | |
scala> all.toService | |
<console>:36: error: You can only convert a router into a Finagle service if the result type of the router is one of the following: | |
* A Response | |
* A value of a type with an EncodeResponse instance | |
* A coproduct made up of some combination of the above | |
shapeless.:+:[Foo1,shapeless.:+:[Foo2,shapeless.:+:[Bar1,shapeless.:+:[Bar2,shapeless.CNil]]]] does not satisfy the requirement. You may need to provide an EncodeResponse instance for shapeless.:+:[Foo1,shapeless.:+:[Foo2,shapeless.:+:[Bar1,shapeless.:+:[Bar2,shapeless.CNil]]]] (or for some part of | |
shapeless.:+:[Foo1,shapeless.:+:[Foo2,shapeless.:+:[Bar1,shapeless.:+:[Bar2,shapeless.CNil]]]]). | |
all.toService | |
^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment