Skip to content

Conversation

brianhuffman
Copy link
Contributor

This PR is a modernization of #1612.

We now have an explicit AST constructor for arbitrary-size tuple values.

Tuple types are formalized as a type constructor that takes a list of types as an argument:

data TypeList : sort 1 where {
TypeNil : TypeList;
TypeCons : sort 0 -> TypeList -> TypeList;
}

primitive Tuple : TypeList -> sort 0;

Additional primitives allow constructing and deconstructing tuples in a nested fashion:

primitive headTuple : (t : sort 0) -> (ts : TypeList) -> Tuple (TypeCons t ts) -> t;
primitive tailTuple : (t : sort 0) -> (ts : TypeList) -> Tuple (TypeCons t ts) -> Tuple ts;
primitive consTuple : (t : sort 0) -> (ts : TypeList) -> t -> Tuple ts -> Tuple (TypeCons t ts);

We now have an explicit AST constructor for arbitrary-size tuple values.

Tuple types are formalized as a type constructor that takes a list
of types as an argument:

data TypeList : sort 1 where {
    TypeNil : TypeList;
    TypeCons : sort 0 -> TypeList -> TypeList;
  }

primitive Tuple : TypeList -> sort 0;

Additional primitives allow constructing and deconstructing tuples
in a nested fashion:

primitive headTuple : (t : sort 0) -> (ts : TypeList) -> Tuple (TypeCons t ts) -> t;
primitive tailTuple : (t : sort 0) -> (ts : TypeList) -> Tuple (TypeCons t ts) -> Tuple ts;
primitive consTuple : (t : sort 0) -> (ts : TypeList) -> t -> Tuple ts -> Tuple (TypeCons t ts);
@brianhuffman
Copy link
Contributor Author

I just rebased this branch onto bh/no-heapster (#2576), so this PR should not be merged before that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant