Writer

smithy4s.codecs.Writer
See theWriter companion object
trait Writer[Message, -A]

An abstraction that codifies the notion of modifying a message with some additional information.

This has two input channels:

  • one for the message that is being modified (Message)
  • one for the actual data (A)

This is particularly useful for http requests/responses, where different subsets of data have a different impact on different locations of the http message : some fields may impact headers, some fields may impact the http body, other things that are driven from static information (smithy traits) may lead to a transformation of the message.

Having the ability to decompose the notion of encoding a piece of data into different writers that can be composed together is powerful and helps centralising some complexity in third-party agnostic code.

Type parameters

A:

the type of data that is being written into the output channel

Message:

some data being modified with the added information contained by A.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Writer[Message, A]

Members list

Value members

Abstract methods

def write(message: Message, a: A): Message

Symbolises the action of writing some content A into an output Out, provided some context In

Symbolises the action of writing some content A into an output Out, provided some context In

Attributes

Concrete methods

def andThen(f: Message => Message): Writer[Message, A]
def combine[A0 <: A](other: Writer[Message, A0]): Writer[Message, A0]
def compose(f: Message => Message): Writer[Message, A]
final def contramap[B](f: B => A): Writer[Message, B]

Contramap the data which this writer works. The writer is a contravariant-functor on A.

Contramap the data which this writer works. The writer is a contravariant-functor on A.

Attributes

final def toEncoder(initial: Message): Encoder[Message, A]

Transforms a writer into an Encoder by supplying an initial value.

Transforms a writer into an Encoder by supplying an initial value.

Attributes