<p dir="ltr">Edward Kmett's NonEmpty module has a version of unfoldr (there just called unfoldr) for non-empty lists that seems also to be useful when applied to regular lists:</p>
<p dir="ltr">unfoldr1::(b -> (a, Maybe b)) -> b -> [a]<br>
unfoldr1 f b= go b<br>
where<br>
go q = case f q of<br>
(a,may_b) -> a : maybe [] go may_b</p>
<p dir="ltr">My question is whether it is possible to write this function using the usual unfoldr. I have the feeling there might be some way, but I just can't see it.</p>
<p dir="ltr">David</p>