Skip to content

Commit

Permalink
drop prelude
Browse files Browse the repository at this point in the history
  • Loading branch information
eshu committed Oct 12, 2023
1 parent 75afb82 commit ca08f0e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zio-http/src/main/scala/zio/http/codec/TextChunkCodec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package zio.http.codec

import scala.annotation.tailrec

import zio.prelude._
import zio.{Chunk, ChunkBuilder, NonEmptyChunk}

sealed trait TextChunkCodec[A, I] {
Expand Down Expand Up @@ -34,7 +33,10 @@ object TextChunkCodec {
case chunk if chunk.isEmpty => DecodeSuccess(None)
case _ => InvalidCardinality(chunk.length, "one or none")
}
override def encode(value: Option[I]): Chunk[String] = (value map codec.encode).toChunk
override def encode(value: Option[I]): Chunk[String] = value match {
case Some(item) => Chunk(codec.encode(item))
case None => Chunk.empty
}
}
def one[I](codec: TextCodec[I]): TextChunkCodec[I, I] = new TextChunkCodec[I, I] {
def parent: TextCodec[I] = codec
Expand Down

0 comments on commit ca08f0e

Please sign in to comment.