= Solution
Use the same step from part (a):
``
groupFold :: Eq a => [a] -> [[a]]
groupFold = foldr prependRun []
``
The <right fold> obeys `groupFold [] = []` and `groupFold (x:xs) = prependRun x (groupFold xs)`, exactly the recursive equations already proved. Both implementations give the <bottom value> for an entirely undefined input spine. Their equal behaviour on finite <partial lists>, together with definable continuity, establishes equality on infinite <lazy lists> as well. The helper's irrefutable binding is what lets the first run be produced without demanding that all subsequent runs already exist.
Back to article page