Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add curried type aliases for Instances to be used as context bounds #193

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions modules/deriving/src/main/scala/shapeless3/deriving/kinds.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ object K0:
type ProductInstances[F[_], T] = ErasedProductInstances[K0.type, F[T]]
type CoproductInstances[F[_], T] = ErasedCoproductInstances[K0.type, F[T]]

type InstancesOf[F[_]] = [T] =>> Instances[F, T]
type ProductInstancesOf[F[_]] = [T] =>> ProductInstances[F, T]
type CoproductInstancesOf[F[_]] = [T] =>> CoproductInstances[F, T]

def Instances[F[_], T](using inst: Instances[F, T]): inst.type = inst
def ProductInstances[F[_], T](using inst: ProductInstances[F, T]): inst.type = inst
def CoproductInstances[F[_], T](using inst: CoproductInstances[F, T]): inst.type = inst
Expand Down Expand Up @@ -193,6 +197,10 @@ object K1:
type ProductInstances[F[_[_]], T[_]] = ErasedProductInstances[K1.type, F[T]]
type CoproductInstances[F[_[_]], T[_]] = ErasedCoproductInstances[K1.type, F[T]]

type InstancesOf[F[_[_]]] = [T[_]] =>> Instances[F, T]
type ProductInstancesOf[F[_[_]]] = [T[_]] =>> ProductInstances[F, T]
type CoproductInstancesOf[F[_[_]]] = [T[_]] =>> CoproductInstances[F, T]

def Instances[F[_[_]], T[_]](using inst: Instances[F, T]): inst.type = inst
def ProductInstances[F[_[_]], T[_]](using inst: ProductInstances[F, T]): inst.type = inst
def CoproductInstances[F[_[_]], T[_]](using inst: CoproductInstances[F, T]): inst.type = inst
Expand Down Expand Up @@ -338,6 +346,10 @@ object K11:
type ProductInstances[F[_[_[_]]], T[_[_]]] = ErasedProductInstances[K11.type, F[T]]
type CoproductInstances[F[_[_[_]]], T[_[_]]] = ErasedCoproductInstances[K11.type, F[T]]

type InstancesOf[F[_[_[_]]]] = [T[_[_]]] =>> Instances[F, T]
type ProductInstancesOf[F[_[_[_]]]] = [T[_[_]]] =>> ProductInstances[F, T]
type CoproductInstancesOf[F[_[_[_]]]] = [T[_[_]]] =>> CoproductInstances[F, T]

def Instances[F[_[_[_]]], T[_[_]]](using inst: Instances[F, T]): inst.type = inst
def ProductInstances[F[_[_[_]]], T[_[_]]](using inst: ProductInstances[F, T]): inst.type = inst
def CoproductInstances[F[_[_[_]]], T[_[_]]](using inst: CoproductInstances[F, T]): inst.type = inst
Expand Down Expand Up @@ -490,6 +502,10 @@ object K2:
type ProductInstances[F[_[_, _]], T[_, _]] = ErasedProductInstances[K2.type, F[T]]
type CoproductInstances[F[_[_, _]], T[_, _]] = ErasedCoproductInstances[K2.type, F[T]]

type InstancesOf[F[_[_, _]]] = [T[_, _]] =>> Instances[F, T]
type ProductInstancesOf[F[_[_, _]]] = [T[_, _]] =>> ProductInstances[F, T]
type CoproductInstancesOf[F[_[_, _]]] = [T[_, _]] =>> CoproductInstances[F, T]

def Instances[F[_[_, _]], T[_, _]](using inst: Instances[F, T]): inst.type = inst
def ProductInstances[F[_[_, _]], T[_, _]](using inst: ProductInstances[F, T]): inst.type = inst
def CoproductInstances[F[_[_, _]], T[_, _]](using inst: CoproductInstances[F, T]): inst.type = inst
Expand Down