Skip to content

Includes relation #9

Description

@nfrisby

I think that embedding one row in another can be done right now with type classes with the current basic interface, but I suspect that an Includes relation would be better behaved, especially alongside row polymorphism.

Includes p q would mean that p has every column that q has, enabling primitives like rupcast :: R f p -> R f q and vupcast :: V f q -> V f p. I anticipate that the necessary evidence would be a bitvector with as many bits as columns in p, each set if that field is in q.

Some non-trivial examples that I anticipate the plugin being able to decide:

  • Includes (p .& l .= t) p.
  • Includes (p .& l .= t1) (q .& l .= t2) implies t1 ~ t2.
  • Not Includes p (q .& l .= t) if Lacks p l.
  • Includes p q and Includes q r implies Includes p r.

(Is there a "closure" of this where a column in q can be present with a different type in p if it is a Row type and the column type in p Includes the column type in q?)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions