zio.blocks.typeid

Members list

Type members

Classlikes

final case class Annotation(typeId: TypeId[_ <: AnyKind], args: List[AnnotationArg] = ...)

Represents a Scala/Java annotation on a type, method, or other declaration.

Represents a Scala/Java annotation on a type, method, or other declaration.

Annotations carry metadata that can be inspected at compile-time or runtime. Examples:

  • @deprecated("use newMethod", "1.0")
  • @tailrec
  • @JsonProperty("field_name")

Value parameters

args

The arguments passed to the annotation constructor

typeId

The TypeId of the annotation class

Attributes

Source
Annotation.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object AnnotationArg

Attributes

Companion
trait
Source
Annotation.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait AnnotationArg

Represents an argument to an annotation.

Represents an argument to an annotation.

Annotation arguments can be:

  • Constant values (strings, numbers, booleans, etc.)
  • Arrays of values
  • Named arguments
  • Nested annotations
  • Class references
  • Enum values

Attributes

Companion
object
Source
Annotation.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ArrayArg
class ClassOf
class Const
class EnumValue
class Named
class Nested
Show all
case object BuildInfo

This object was generated by sbt-buildinfo.

This object was generated by sbt-buildinfo.

Attributes

Source
BuildInfo.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
BuildInfo.type
final case class EnumCaseParam(name: String, tpe: TypeRepr)

A parameter of an enum case.

A parameter of an enum case.

Value parameters

name

The parameter name

tpe

The parameter type

Attributes

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

A compile-time witness that A is a nominal intersection type — either a single nominal type or a conjunction (A & B / A with B) of nominal types.

A compile-time witness that A is a nominal intersection type — either a single nominal type or a conjunction (A & B / A with B) of nominal types.

Each member of the intersection must itself satisfy IsNominalType constraints: no union branches, no structural refinements, no unresolved type parameters. Derivation fails at compile time if any member is non-nominal.

The primary use-case is Context, which keys its internal map by the erased TypeId of each member in the intersection.

Type parameters

A

The intersection type being witnessed. May be a plain nominal type (in which case typeIdsErased has length 1) or an intersection (length ≥ 2).

Attributes

Companion
object
Source
IsNominalIntersection.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Source
IsNominalIntersection.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait IsNominalType[A]

A compile-time witness that A is a nominal type.

A compile-time witness that A is a nominal type.

A nominal type is any fully-known, concrete named type: a class, trait, object, enum, or applied type constructor (e.g. List[Int]). Abstract type parameters, union types (A | B), intersection types (A & B), structural refinements, and type lambdas are not nominal and will cause derivation to fail with a compile error.

IsNominalType[A] is automatically derived by a macro when A is nominal. The key effect of requiring IsNominalType[A] in a method signature is that it prevents the method from being called with an unresolved type parameter, ensuring the type is concrete at the call site.

Type parameters

A

The type being witnessed as nominal.

Attributes

Companion
object
Source
IsNominalType.scala
Supertypes
class Object
trait Matchable
class Any
object IsNominalType

Attributes

Companion
trait
Source
IsNominalType.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait Kind

Represents the "kind" of a type - the type of a type.

Represents the "kind" of a type - the type of a type.

In Scala's type system:

  • Proper types like Int, String have kind * (Type)
  • Type constructors like List, Option have kind * -> *
  • Higher-kinded types like Monad have kind (* -> *) -> *

This is essential for correctly representing higher-kinded types and ensuring kind-correctness in type expressions.

Attributes

Companion
object
Source
Kind.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Arrow
object Type
object Kind

Attributes

Companion
trait
Source
Kind.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Kind.type
sealed trait Member

Represents a member of a structural (refinement) type.

Represents a member of a structural (refinement) type.

Members include:

  • Val/Var declarations (val x: Int, var y: String)
  • Method declarations (def foo(x: Int): String)
  • Type members (type T, type T &lt;: Bound)

Attributes

Companion
object
Source
Member.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Def
class TypeMember
class Val
object Member

Attributes

Companion
trait
Source
Member.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Member.type
object Owner

Attributes

Companion
class
Source
Owner.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Owner.type
final case class Owner(segments: List[Segment])

Represents where a type is defined in the Scala/Java ecosystem.

Represents where a type is defined in the Scala/Java ecosystem.

An Owner encapsulates the hierarchical ownership chain of a type, which can include packages, terms (objects/values), and types.

For example, for a type MyClass defined as:

package com.example
object Outer {
 class MyClass
}

The owner would be:

Owner(List(
 Owner.Package("com"),
 Owner.Package("example"),
 Owner.Term("Outer")
))

Attributes

Companion
object
Source
Owner.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Param(name: String, tpe: TypeRepr, isImplicit: Boolean = ..., hasDefault: Boolean = ...)

A method parameter.

A method parameter.

Value parameters

defaultValue

Whether this parameter has a default value (we don't store the value itself)

isImplicit

Whether this is an implicit parameter

name

The name of the parameter

tpe

The type of the parameter

Attributes

Source
Member.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class TermPath(segments: List[Segment])

Represents a path to a term value, used for singleton types.

Represents a path to a term value, used for singleton types.

For example, for a singleton type MyObject.Inner.value.type:

TermPath(List(
 TermPath.Package("com"),
 TermPath.Package("example"),
 TermPath.Term("MyObject"),
 TermPath.Term("Inner"),
 TermPath.Term("value")
))

Attributes

Companion
object
Source
TermPath.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object TermPath

Attributes

Companion
class
Source
TermPath.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
TermPath.type
final case class TupleElement(label: Option[String], tpe: TypeRepr)

An element of a tuple type.

An element of a tuple type.

In Scala 3.5+, tuple elements can have labels (named tuples): (name: String, age: Int)

Value parameters

label

Optional label for named tuples

tpe

The type of this element

Attributes

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

Attributes

Companion
class
Source
TypeBounds.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
TypeBounds.type
final case class TypeBounds(lower: Option[TypeRepr] = ..., upper: Option[TypeRepr] = ...)

Represents the bounds of a type parameter or abstract type member.

Represents the bounds of a type parameter or abstract type member.

In Scala, type bounds are expressed as:

  • A : Lower (lower bound only)
  • `A >: Lower :), None means Nothing

Value parameters

upper

The upper bound (<:), None means Any

Attributes

Companion
object
Source
TypeBounds.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object TypeDefKind

Attributes

Companion
trait
Source
TypeDefKind.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait TypeDefKind

Classifies what kind of type definition a TypeId represents.

Classifies what kind of type definition a TypeId represents.

This enables distinguishing between:

  • Classes (regular, case, abstract, final, value)
  • Traits (regular, sealed)
  • Objects (singleton objects)
  • Enums (Scala 3 enums with cases)
  • Type aliases and opaque types
  • Abstract type members

Attributes

Companion
object
Source
TypeDefKind.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AbstractType
class Class
class Enum
class EnumCase
class Object
class OpaqueType
class Trait
object TypeAlias
object Unknown
Show all
sealed trait TypeId[A <: AnyKind] extends TypeIdPlatformSpecific

Represents the identity of a type or type constructor.

Represents the identity of a type or type constructor.

TypeId provides rich type identity information including:

  • The type's name
  • The owner (package/class/object where it's defined)
  • Type parameters (for type constructors)
  • Classification (nominal, alias, or opaque)
  • Parent types and self type
  • Annotations

The phantom type parameter A ensures type safety when working with TypeId values. In Scala 3, A is bounded by AnyKind to support higher-kinded types.

Type parameters

A

The type (or type constructor) this TypeId represents

Attributes

Companion
object
Source
TypeId.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

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

Attributes

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

Provides predefined TypeId instances for common types. These instances are available implicitly when importing TypeId.

Provides predefined TypeId instances for common types. These instances are available implicitly when importing TypeId.

Attributes

Companion
object
Source
TypeIdInstances.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object TypeId

Low-priority implicit for TypeId derivation.

Low-priority implicit for TypeId derivation.

This trait provides the derived given which has lower priority than the predefined instances in TypeIdInstances. This ensures that when both a predefined instance and derived could match, the predefined instance wins.

Attributes

Source
TypeIdLowPriority.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object TypeId
object TypeIdMacros

Attributes

Source
TypeIdMacros.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Platform-specific methods for TypeId.

Platform-specific methods for TypeId.

On JVM, provides reflection-based capabilities. On JS, returns None for reflection operations.

Attributes

Source
TypeIdPlatformSpecific.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait TypeId[A]
Self type
TypeId[_ <: AnyKind]
object TypeIdPrinter

Provides idiomatic Scala type rendering for TypeId, TypeRepr, and TypeParam.

Provides idiomatic Scala type rendering for TypeId, TypeRepr, and TypeParam.

This object converts type representations into readable Scala syntax strings, making them suitable for display in error messages, documentation, and debugging output.

Attributes

Source
TypeIdPrinter.scala
Supertypes
class Object
trait Matchable
class Any
Self type
object TypeParam

Attributes

Companion
class
Source
TypeParam.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
TypeParam.type
final case class TypeParam(name: String, index: Int, variance: Variance = ..., bounds: TypeBounds = ..., kind: Kind = ...)

Represents a type parameter specification.

Represents a type parameter specification.

A TypeParam captures the essential information about a type parameter, including its name, position, variance, bounds, and kind.

For example, for Either[+A, +B]:

  • A would be TypeParam("A", 0, Variance.Covariant)
  • B would be TypeParam("B", 1, Variance.Covariant)

For Functor[F[_]]:

  • F would be TypeParam("F", 0, Variance.Invariant, TypeBounds.Unbounded, Kind.Star1)

Value parameters

bounds

The type bounds (>: Lower *, etc.)

index

The position in the type parameter list (0-indexed)

name

The name of the type parameter

variance

The variance annotation (+, -, or none)

Attributes

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

Attributes

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

Represents type expressions in the Scala type system.

Represents type expressions in the Scala type system.

TypeRepr can represent:

  • Simple type references (Int, String)
  • Applied types (List[Int], Map[String, Int])
  • Type parameter references (A, F[_])
  • Structural/refinement types ({ def foo: Int })
  • Intersection types (A & B & C)
  • Union types (A | B | C)
  • Tuple types ((A, B, C))
  • Function types (A => B, (A, B) ?=> C)
  • Singleton types (x.type)
  • Literal/constant types (42, "foo")
  • Type lambdas ([X] =>> F[X])
  • Wildcards (? : Lower)
  • And more...

Attributes

Companion
object
Source
TypeRepr.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Annotated
object AnyKindType
object AnyType
class Applied
class ByName
trait Constant
class BooleanConst
class CharConst
class ClassOfConst
class DoubleConst
class FloatConst
class IntConst
class LongConst
object NullConst
class StringConst
object UnitConst
class Function
class Intersection
object NothingType
object NullType
class ParamRef
class Ref
class Repeated
class Singleton
class Structural
class ThisType
class Tuple
class TypeLambda
class TypeSelect
class Union
object UnitType
class Wildcard
Show all
object Variance

Attributes

Companion
trait
Source
Variance.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Variance.type
sealed trait Variance

Represents the variance of a type parameter.

Represents the variance of a type parameter.

Variance determines how subtyping of type arguments affects subtyping of parameterized types:

  • Covariant (+A): If Dog &lt;: Animal, then List[Dog] &lt;: List[Animal]
  • Contravariant (-A): If Dog &lt;: Animal, then Handler[Animal] &lt;: Handler[Dog]
  • Invariant (A): No subtyping relationship between Box[Dog] and Box[Animal]

Attributes

Companion
object
Source
Variance.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Contravariant
object Covariant
object Invariant