Additional instances and attributes for streams #
@[protected, instance]
Equations
- stream.inhabited = {default := stream.const (default α)}
take s n
returns a list of the n
first elements of stream s
Equations
- s.take n = list.map s (list.range n)
Use a state monad to generate a stream through corecursion
Equations
- stream.corec_state cmd s = stream.corec prod.fst (cmd.run ∘ prod.snd) (cmd.run s)