-
Notifications
You must be signed in to change notification settings - Fork 66
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
Showing
2 changed files
with
34 additions
and
2 deletions.
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
33 changes: 32 additions & 1 deletion
33
zio-interop-cats/shared/src/main/scala/zio/stream/interop/fs2z.scala
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 |
---|---|---|
@@ -1,5 +1,36 @@ | ||
package zio.stream.interop | ||
|
||
object fs2z extends FS2Platform | ||
import fs2.io.net.Network | ||
import fs2.io.file.Files | ||
import fs2.io.net.unixsocket.UnixSockets | ||
import zio.* | ||
import zio.interop.CatsEffectInstances | ||
|
||
object fs2z extends FS2Platform { | ||
object io extends FS2IOPlatform | ||
} | ||
|
||
abstract class FS2Platform extends FS2StreamSyntax | ||
|
||
abstract class FS2IOPlatform extends FS2IOFilesInstances with FS2IONetworkInstances with FS2IOUnixSocketsInstances | ||
|
||
trait FS2IOFilesInstances extends CatsEffectInstances { | ||
|
||
implicit final def filesInstance[R]: Files[RIO[R, _]] = | ||
Files.forAsync(asyncInstance[R]) | ||
|
||
} | ||
|
||
trait FS2IONetworkInstances extends CatsEffectInstances { | ||
|
||
implicit final def networkInstance[R]: Network[RIO[R, _]] = | ||
Network.forAsync(asyncInstance[R]) | ||
|
||
} | ||
|
||
trait FS2IOUnixSocketsInstances extends CatsEffectInstances { | ||
|
||
implicit final def unixSocketsInstance[R]: UnixSockets[RIO[R, _]] = | ||
UnixSockets.forAsync(asyncInstance[R]) | ||
|
||
} |