polarity/std/codata/stream.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

13 lines
435 B
Text

/// The codata type of infinite streams.
codata Stream(a: Type) {
/// The head observation which yields the first element.
Stream(a).hd(implicit a: Type): a,
/// The tail observation which yields the remainder of the stream.
Stream(a).tl(implicit a: Type): Stream(a),
}
/// An infinite stream which repeats the argument.
codef Repeat(a: Type, elem: a): Stream(a) {
.hd(_) => elem,
.tl(_) => Repeat(a, elem),
}