DerivedOptics

zio.blocks.schema.DerivedOptics
See theDerivedOptics companion trait
object DerivedOptics

Holds DerivedOptics.Of and the runtime helpers that the optics macros call.

Attributes

Companion
trait
Source
DerivedOptics.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

trait Of[S]

Mix DerivedOptics.Of[S] into any object to get the optics of S when S is not the class of that object's companion: a generic instantiation such as Box[Int], a type alias, or a type whose companion you cannot change. It works like DerivedOptics, with S given explicitly. optics needs an implicit Schema[S] where it is called, so a schema defined in the object has to be imported there.

Mix DerivedOptics.Of[S] into any object to get the optics of S when S is not the class of that object's companion: a generic instantiation such as Box[Int], a type alias, or a type whose companion you cannot change. It works like DerivedOptics, with S given explicitly. optics needs an implicit Schema[S] where it is called, so a schema defined in the object has to be imported there.

// scala-3-only
case class Box[A](value: A)
object BoxInt extends DerivedOptics.Of[Box[Int]] {
 implicit val schema: Schema[Box[Int]] = Schema.derived
}

import BoxInt.schema
val value: Lens[Box[Int], Int] = BoxInt.optics.value

Attributes

Source
DerivedOptics.scala
Supertypes
class Object
trait Matchable
class Any