Skip to content

Commit

Permalink
Merge pull request #335 from catostrophe/fs2-pre
Browse files Browse the repository at this point in the history
Add Pre syntax for attaching fs2.Stream algebras
  • Loading branch information
Odomontois authored Aug 6, 2020
2 parents 410a27d + 2329a3a commit f5f3396
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions fs2/src/main/scala/tofu/fs2Syntax/pre.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package tofu.fs2Syntax

import cats.tagless.ApplyK
import fs2.Stream
import tofu.higherKind.Pre.T
import tofu.syntax.funk.funK

object pre {
implicit final class TofuPreStreamSyntax[F[_], U[f[_]]](private val self: U[T[F, *]]) extends AnyVal {
def attachStream(alg: U[Stream[F, *]])(implicit U: ApplyK[U]): U[Stream[F, *]] =
U.map2K(self, alg)(funK(t2k => Stream.eval_(t2k.first.value) ++ t2k.second))
}
}

0 comments on commit f5f3396

Please sign in to comment.