FromData

scalus.builtin.FromData
See theFromData companion trait
object FromData

FromData[A] derivation

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
FromData.type

Members list

Value members

Concrete methods

inline def derived[A]: FromData[A]

Deprecated methods

inline def deriveCaseClass[T]: FromData[T]

Attributes

Deprecated
true
inline def deriveConstructor[T]: (List[Data]) => T

Attributes

Deprecated
true
inline def deriveEnum[T](inline conf: PartialFunction[Int, (List[Data]) => T]): FromData[T]

Derive FromData for an enum type

Derive FromData for an enum type

Value parameters

conf

a partial function mapping tag to constructor function, like

Attributes

Returns

a FromData instance

Example
 enum Adt:
   case A
   case B(b: Boolean)
   case C(a: Adt, b: Adt)
 given FromData[Adt] = FromData.deriveEnum[Adt] {
   case 0 => _ => Adt.A
   case 1 => FromData.deriveConstructor[Adt.B]
   case 2 => FromData.deriveConstructor[Adt.C]
   }
Deprecated
true
inline def deriveEnum[T]: FromData[T]

Derive FromData for an enum type

Derive FromData for an enum type

Attributes

Returns

a FromData instance

Example
 enum Adt:
   case A
   case B(b: Boolean)
   case C(a: Adt, b: Adt)
 given FromData[Adt] = FromData.deriveEnum[Adt]
Deprecated
true

Givens