Encoder

kantan.codecs.Encoder
See theEncoder companion object
trait Encoder[E, D, T] extends Serializable

Type class for types that can be encoded into others.

Type parameters

D

decoded type - what to encode from.

E

encoded type - what to encode to.

T

tag type.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait Codec[E, D, F, T]

Members list

Value members

Abstract methods

def encode(d: D): E

Encodes the specified value.

Encodes the specified value.

Attributes

Concrete methods

def contramap[DD](f: DD => D): Encoder[E, DD, T]

Creates a new Encoder instances that applies the specified function before encoding.

Creates a new Encoder instances that applies the specified function before encoding.

This is a convenient way of creating Encoder instances: if you already have an Encoder[E, D, R], need to write an Encoder[E, DD, R] and know how to turn a DD into a D, you need but call contramap.

Attributes

def mapEncoded[EE](f: E => EE): Encoder[EE, D, T]
def tag[TT]: Encoder[E, D, TT]