From 1fccbbcfedafdd6d483b1b5c16e7e2a01a6ee0f1 Mon Sep 17 00:00:00 2001 From: Filippo Mariotti Date: Sun, 30 Dec 2018 21:53:40 +0100 Subject: [PATCH] Monad for Applicative and FlatMap --- fs2/src/main/scala/laserdisc/fs2/RedisConnection.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs2/src/main/scala/laserdisc/fs2/RedisConnection.scala b/fs2/src/main/scala/laserdisc/fs2/RedisConnection.scala index 750f73f9..d0ed6d03 100644 --- a/fs2/src/main/scala/laserdisc/fs2/RedisConnection.scala +++ b/fs2/src/main/scala/laserdisc/fs2/RedisConnection.scala @@ -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._ @@ -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)))