inits package:nonempty-containers

Returns a sequence of all non-empty prefixes of this sequence, shortest first. For example,
tails (fromList (1:|[2,3])) = fromList (fromList (1:|[]) :| [fromList (1:|[2]), fromList (1:|[2,3]))
Evaluating the <math>th prefix takes <math>, but evaluating every prefix in the sequence takes <math> due to sharing.