Dependent records can be implemented in various ways, but some papers suggests I could do it in the following way:
- The construction of dependent record type is made by selecting labels and types.
- The construction of dependent record is made by filling up the fields.
- The destruction is made by selecting a label.
Eg. We could therefore do something like: sig : {fst: A, snd: B fst}
to represent sigma. Then construct it with sig = {fst=a, snd=b}
, and retrieve the second field with sig.snd
.
But now I hit elaboration phase where the input program is turned into bunch of constraints. This means I do not necessarily have information about the record type before I resolve record fields. With the naive elaborator I have no information about types during elaboration.
Specifically for inference. Given some (a:_)
with type yet undetermined and then label a.snd
. Which type should I give when I cannot know the specific record? What can I do in this situation?