The unfoldr builds a list from a seed value. In some cases, unfoldr can undo a foldr operation.
unfoldr (\b => if b == 0 then Nothing else Just (b, b-1)) 10
Take the first n
elements of xs
If there are not enough elements, return the whole coList.
how many elements to take
the coList to take them from
Idris will know that it always can produce a new element in finite time
Append two CoLists