Skip to content

Invert the FreeVariable -> FVWithContext -> FVWithContextWithProps trait heirarchy #46

@MingweiSamuel

Description

@MingweiSamuel

Right now we have:

pub trait FreeVariableWithContextWithProps<Ctx, Props>;

impl<Ctx, T: FreeVariableWithContextWithProps<Ctx, ()>> FreeVariableWithContext<Ctx> for T {}
pub trait FreeVariableWithContext<Ctx>: FreeVariableWithContextWithProps<Ctx, Props = ()>;

impl<O, T: FreeVariableWithContext<(), O = O>> FreeVariable<O> for T {}
pub trait FreeVariable: FreeVariableWithContext<Ctx = ()>;

Which is not quite right, because really FreeVariable should be equivalent to FreeVariableWithContext<*AnyContext> (but is only equivalent to Ctx=())

Inverting this heirarchy would express this properly:

pub trait FreeVariable;

impl<V, Ctx> FreeVariableWithContext<Ctx> for V where V: FreeVariable;
pub trait FreeVariableWithContext<Ctx>;

impl<V, Ctx, Props> FreeVariableWithContextWithProps<Ctx, Props> for V where V: FreeVariableWithContext<Ctx>;
pub trait FreeVariableWithContextWithProps<Ctx, Props>;

This at least makes sense for for the context. Unsure about how the props work, as maybe a FreeVariable should have no props instead of all props?

This does solve the problem of #45 as that trait just ends up being the regular FreeVariable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions