Derive

zio.prelude.Derive
See theDerive companion object
trait Derive[F[_], Typeclass[_]]

Derive[F, Typeclass] represents a universally quantified function from Typeclass[A] to Typeclass[F[A]] for some F[_]. You can think of Derive as a "recipe" for building a Typeclass[F[A]] instance given a Typeclass[A].

For example, if we know how to compare values of type A for equality then we can compare lists with elements of type A for equality by checking that the length of the lists is the same and each pair of corresponding elements are equal. And we can do this for any type A as long as it has an Equal instance.

This is used by the library to derive typeclass instances for higher kinded types given typeclass instances for the type they are parameterized on.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def derive[A : Typeclass]: Typeclass[F[A]]