Skip to content

Commit

Permalink
Monad for Applicative and FlatMap
Browse files Browse the repository at this point in the history
  • Loading branch information
barambani committed Dec 30, 2018
1 parent f9783ac commit 1fccbbc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs2/src/main/scala/laserdisc/fs2/RedisConnection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import java.nio.channels.AsynchronousChannelGroup

import _root_.fs2._
import _root_.fs2.io.tcp.Socket
import cats.{Applicative, FlatMap}
import cats.Monad
import cats.effect.{ConcurrentEffect, ContextShift, Effect}
import cats.syntax.applicative._
import cats.syntax.flatMap._
Expand Down Expand Up @@ -38,7 +38,7 @@ object RedisConnection {

private[fs2] final object impl {

def send[F[_]: Applicative: FlatMap](sink: Sink[F, Byte])(implicit log: LogWriter[F]): Sink[F, RESP] =
def send[F[_]: Monad](sink: Sink[F, Byte])(implicit log: LogWriter[F]): Sink[F, RESP] =
_.evalMap(resp => log.debug(s"sending $resp") >> resp.pure)
.through(streamEncoder.encode)
.flatMap(bits => Stream.chunk(Chunk.array(bits.toByteArray)))
Expand Down

0 comments on commit 1fccbbc

Please sign in to comment.