polarity/std/data/vec.pol
Brendan Zabarauskas 1a10bdc950
Use trailing commas when pretty printing (#508)
* Use trailing commas when pretty printing

* Use trailing commas in examples and prelude
2025-03-27 09:13:09 +00:00

15 lines
389 B
Text

use "./nat.pol"
/// The type of length-indexed lists.
data Vec(n : Nat, a: Type) {
/// The empty vector.
VNil(a : Type) : Vec(Z, a),
/// Appending one element to a vector.
VCons(n : Nat, a: Type, x: a, xs: Vec(n,a)) : Vec(S(n), a),
}
/// The first element of a non-empty vector.
def Vec(S(n), a).head(n: Nat, a: Type) : a {
VNil(_) absurd,
VCons(_,_,x,_) => x,
}