Universe lifting for type families #
Some functors such as Option and List are universe polymorphic. Unlike
type polymorphism where Option α is a function application and reasoning and
generalizations that apply to functions can be used, Option.{u} and Option.{v}
are not one function applied to two universe names but one polymorphic definition
instantiated twice. This means that whatever works on Option.{u} is hard
to transport over to Option.{v}. ULiftable is an attempt at improving the situation.
ULiftable Option.{u} Option.{v} gives us a generic and composable way to use
Option.{u} in a context that requires Option.{v}. It is often used in tandem with
ULift but the two are purposefully decoupled.
Main definitions #
ULiftableclass
Tags #
universe polymorphism functor
Given a universe polymorphic type family M.{u} : Type u₁ → Type u₂, this class convert between instantiations, from
M.{u} : Type u₁ → Type u₂ to M.{v} : Type v₁ → Type v₂ and back.
f is an outParam, because g can almost always be inferred from the current monad.
At any rate, the lift should be unique, as the intent is to only lift the same constants with
different universe parameters.
Instances
Equations
The most common practical use ULiftable (together with down), the function up.{v} takes
x : M.{u} α and lifts it to M.{max u v} (ULift.{v} α)
Equations
Instances For
The most common practical use of ULiftable (together with up), the function down.{v} takes
x : M.{max u v} (ULift.{v} α) and lowers it to M.{u} α
Equations
Instances For
A version of up for a PUnit return type.
Equations
Instances For
A version of down for a PUnit return type.