Skip to content

How to synthesize a higher-kinded type parameter? #20000

Discussion options

You must be logged in to vote

To answer my own question: higher-kinds can be represented as TypeBounds with an upper bound of TypeLambda.

For example,

TypeBounds(
  low = TypeRepr.of[Nothing],
  hi  = TypeLambda(
    List("X"),
    _ => List(TypeBounds.empty), 
    _ => TypeRepr.of[Any]
  )
)

are bounds of a type parameter F[_].

The resulting TypeBounds can then be used in construction of PolyType.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TomasMikula
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant