Instances For
- mk' :: (
- inner : ComputableSmall.Target α
- )
Instances For
Equations
- Std.Internal.USquashOrUnit α = if x : Std.Internal.Small α then Std.Internal.USquash α else PUnit
Instances For
Equations
- Std.Internal.USquash.deflate x = { inner := Std.Internal.ComputableSmall.deflate x }
Instances For
Equations
Instances For
If m
is a monad, then HetT m
is a monad that has two features:
- It generalizes
m
to arbitrary universes. - It tracks a postcondition property that holds for the monadic return value, similarly to
PostconditionT
.
This monad is noncomputable and is merely a vehicle for more convenient proofs, especially proofs about the equivalence of iterators, because it avoids universe issues and spares users the work to handle the postconditions manually.
Caution: Just like PostconditionT
, this is not a lawful monad transformer.
To lift from m
to HetT m
, use HetT.lift
.
Because this monad is fundamentally universe-polymorphic, it is recommended for consistency to
always use the methods HetT.pure
, HetT.map
and HetT.bind
instead of the homogeneous versions
Pure.pure
, Functor.map
and Bind.bind
.
- Property : α → Prop
A predicate that holds for the return value(s) of the
m
-monadic operation. - small : Internal.Small (Subtype self.Property)
A proof that the possible return values are equivalent to a
w
-small type. - operation : m (Internal.USquash (Subtype self.Property))
The actual monadic operation. Its return value is bundled together with a proof that it satisfies
Property
and squashed so that it fits into the monadm
.
Instances For
Converts PostconditionT m α
to HetT m α
, preserving the postcondition property.
Equations
- Std.Iterators.HetT.ofPostconditionT x = { Property := x.Property, small := ⋯, operation := Std.Internal.USquash.deflate <$> x.operation }
Instances For
A universe-heterogeneous version of Pure.pure
. Given a : α
, it returns an element of HetT m α
with the postcondition (a = ·)
.
Equations
- Std.Iterators.HetT.pure a = { Property := fun (x : α) => a = x, small := ⋯, operation := pure (Std.Internal.USquash.deflate ⟨a, ⋯⟩) }
Instances For
A generalization of HetT.map
that provides the postcondition property to the mapping function.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A universe-heterogeneous version of Functor.map
.
Equations
- Std.Iterators.HetT.map f x = x.pmap fun (a : α) (x : x.Property a) => f a
Instances For
A generalization of HetT.bind
that provides the postcondition property to the mapping function.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Std.Iterators.instFunctorHetT = { map := fun {α β : Type ?u.19} => Std.Iterators.HetT.map }
Applies the given function to the result of the contained m
-monadic operation with a
proof that the postcondition property holds, returning another operation in m
.