TypeRepr

zio.blocks.typeid.TypeRepr
See theTypeRepr companion trait
object TypeRepr

Attributes

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

Members list

Type members

Classlikes

final case class Annotated(underlying: TypeRepr, annotations: List[Annotation]) extends TypeRepr

Annotated type: A @annotation.

Annotated type: A @annotation.

A type with one or more annotations attached.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
case object AnyKindType extends TypeRepr

Any kind type (for kind-polymorphic contexts).

Any kind type (for kind-polymorphic contexts).

Attributes

Source
TypeRepr.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
Self type
case object AnyType extends TypeRepr

The top type: Any.

The top type: Any.

Attributes

Source
TypeRepr.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
Self type
AnyType.type
final case class Applied(tycon: TypeRepr, args: List[TypeRepr]) extends TypeRepr

Application of a type constructor to type arguments.

Application of a type constructor to type arguments.

Examples:

  • List[Int] → Applied(Ref(listId), List(Ref(intId)))
  • Map[String, Int] → Applied(Ref(mapId), List(Ref(stringId), Ref(intId)))
  • F[A] → Applied(ParamRef(F), List(ParamRef(A)))

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class ByName(underlying: TypeRepr) extends TypeRepr

By-name parameter type: => A.

By-name parameter type: => A.

The argument is evaluated lazily each time it's used.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
object Constant

Attributes

Companion
trait
Source
TypeRepr.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Constant.type
sealed trait Constant extends TypeRepr

Constant/literal type: 42, "foo", true.

Constant/literal type: 42, "foo", true.

Scala 3 supports literal types natively; Scala 2.13 with -Xliteral-types.

Attributes

Companion
object
Source
TypeRepr.scala
Supertypes
trait TypeRepr
class Object
trait Matchable
class Any
Known subtypes
class BooleanConst
class CharConst
class ClassOfConst
class DoubleConst
class FloatConst
class IntConst
class LongConst
object NullConst
class StringConst
object UnitConst
Show all
final case class ContextFunction(params: List[TypeRepr], result: TypeRepr) extends TypeRepr

Context function type: (A, B) ?=> C (Scala 3).

Context function type: (A, B) ?=> C (Scala 3).

Context functions provide their arguments implicitly.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class Function(params: List[TypeRepr], result: TypeRepr) extends TypeRepr

Function type: (A, B) => C.

Function type: (A, B) => C.

Value parameters

params

Parameter types

result

Result type

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final class Intersection extends TypeRepr

Intersection type: A & B & C (Scala 3) or A with B with C (Scala 2).

Intersection type: A & B & C (Scala 3) or A with B with C (Scala 2).

The list contains at least 2 types. For single types, use the type directly.

Note: Equality is order-independent, so A & B equals B & A.

Attributes

Companion
object
Source
TypeRepr.scala
Supertypes
trait TypeRepr
class Object
trait Matchable
class Any
object Intersection

Attributes

Companion
class
Source
TypeRepr.scala
Supertypes
class Object
trait Matchable
class Any
Self type
case object NothingType extends TypeRepr

The bottom type: Nothing.

The bottom type: Nothing.

Attributes

Source
TypeRepr.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
Self type
case object NullType extends TypeRepr

The null type: Null.

The null type: Null.

Attributes

Source
TypeRepr.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
Self type
NullType.type
final case class ParamRef(param: TypeParam, binderDepth: Int = ...) extends TypeRepr

Reference to a type parameter.

Reference to a type parameter.

Used within type expressions to refer to type parameters. For example, in List[A], the A is a ParamRef(TypeParam("A", 0)).

Value parameters

binderDepth

De Bruijn index for nested type lambdas (0 = innermost binder)

param

The type parameter being referenced

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class Ref(id: TypeId[_ <: AnyKind]) extends TypeRepr

Reference to a named type (possibly a type constructor if id.arity > 0).

Reference to a named type (possibly a type constructor if id.arity > 0).

Examples:

  • Int → Ref(intId) where intId.arity == 0
  • List (unapplied) → Ref(listId) where listId.arity == 1

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class Repeated(element: TypeRepr) extends TypeRepr

Repeated parameter type: A* (varargs).

Repeated parameter type: A* (varargs).

Used for variadic parameters.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class Singleton(path: TermPath) extends TypeRepr

Singleton type: x.type.

Singleton type: x.type.

Represents the type of a specific term/value.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class Structural(parents: List[TypeRepr], members: List[Member]) extends TypeRepr

Structural (refinement) type.

Structural (refinement) type.

Examples:

  • { def foo: Int } → Structural(Nil, List(Def("foo", Nil, Nil, Ref(intId))))
  • AnyRef { type T; val x: T } → Structural(List(Ref(anyRefId)), List(...))

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class ThisType(owner: Owner) extends TypeRepr

This type: this.type within a class/trait.

This type: this.type within a class/trait.

Represents the singleton type of the enclosing instance.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class Tuple(elems: List[TupleElement]) extends TypeRepr

Tuple type: (A, B, C) or named tuples (name: String, age: Int) (Scala 3.5+).

Tuple type: (A, B, C) or named tuples (name: String, age: Int) (Scala 3.5+).

Value parameters

elems

The tuple elements, each with an optional label

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class TypeLambda(params: List[TypeParam], body: TypeRepr) extends TypeRepr

Type lambda: [X, Y] =>> F[X, Y] (Scala 3).

Type lambda: [X, Y] =>> F[X, Y] (Scala 3).

Represents an anonymous type-level function.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class TypeProjection(qualifier: TypeRepr, name: String) extends TypeRepr

Type projection: Outer#Inner.

Type projection: Outer#Inner.

Refers to a type member of another type.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final case class TypeSelect(qualifier: TypeRepr, name: String) extends TypeRepr

Type selection: qualifier.Member.

Type selection: qualifier.Member.

Path-dependent type access through a term.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
final class Union extends TypeRepr

Union type: A | B | C (Scala 3 only).

Union type: A | B | C (Scala 3 only).

The list contains at least 2 types. For single types, use the type directly.

Note: Equality is order-independent, so A | B equals B | A.

Attributes

Companion
object
Source
TypeRepr.scala
Supertypes
trait TypeRepr
class Object
trait Matchable
class Any
object Union

Attributes

Companion
class
Source
TypeRepr.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Union.type
case object UnitType extends TypeRepr

The unit type: Unit.

The unit type: Unit.

Attributes

Source
TypeRepr.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all
Self type
UnitType.type
final case class Wildcard(bounds: TypeBounds = ...) extends TypeRepr

Wildcard type with bounds: ?, ? : Lower.

Wildcard type with bounds: ?, ? : Lower.

Used in type arguments when the exact type is not specified.

Attributes

Source
TypeRepr.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait TypeRepr
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def function(params: List[TypeRepr], result: TypeRepr): TypeRepr

Creates a simple function type.

Creates a simple function type.

Attributes

Source
TypeRepr.scala
def intersection(types: List[TypeRepr]): TypeRepr

Creates an intersection of multiple types.

Creates an intersection of multiple types.

Attributes

Source
TypeRepr.scala
def tuple(types: List[TypeRepr]): TypeRepr

Creates a simple tuple (unlabeled elements).

Creates a simple tuple (unlabeled elements).

Attributes

Source
TypeRepr.scala
def union(types: List[TypeRepr]): TypeRepr

Creates a union of multiple types.

Creates a union of multiple types.

Attributes

Source
TypeRepr.scala