-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
585ca33
commit 3083772
Showing
5 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import zio._ | ||
|
||
object layers { | ||
|
||
trait Service1 | ||
trait Service2 | ||
trait Service3 | ||
trait Service4 | ||
|
||
val service1 = ZLayer.succeed(new Service1 {}) | ||
|
||
val service2 = ZLayer.succeed(new Service2 {}) | ||
|
||
val service3 = ZLayer.fromService { (_: Service1) => new Service3 {} } | ||
|
||
val service4 = ZLayer.succeed(new Service4 {}) | ||
|
||
val services: ULayer[Has[Service1] with Has[Service2] with Has[Service3] with Has[Service4]] = | ||
service1 ++ service2 >+> service3// ++ service4 | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
type mismatch; | ||
ZLayer[, Nothing, <none>|Has[Service4] with Has[Service1] with Has[Service2] with Has[Service3]] |