If there is an unfoldM like function then that might do the job, with Maybe or MaybeT m as your choice of monad.<div><br></div><div>Ollie<br><br><div class="gmail_quote"><div dir="ltr">On Mon, 2 May 2016, 11:49 p.m. John Ky, <<a href="mailto:newhoggy@gmail.com">newhoggy@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><p style="margin:0px 0px 1.2em!important">Hello,</p>
<p style="margin:0px 0px 1.2em!important">Does anyone know of anything like <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">Data.ByteString.unfoldr</code>, except that it can fail with a return value?</p>
<p style="margin:0px 0px 1.2em!important">Cheers,</p>
<p style="margin:0px 0px 1.2em!important">-John</p>
<div title="MDH:SGVsbG8sPGRpdj48YnI+PC9kaXY+PGRpdj5Eb2VzIGFueW9uZSBrbm93IG9mIGFueXRoaW5nIGxp
a2UgYERhdGEuQnl0ZVN0cmluZy51bmZvbGRyYCwgZXhjZXB0IHRoYXQgaXQgY2FuIGZhaWwgd2l0
aCBhIHJldHVybiB2YWx1ZT88L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PkNoZWVycyw8L2Rpdj48
ZGl2Pjxicj48L2Rpdj48ZGl2Pi1Kb2huPC9kaXY+PGRpdj48YnI+PC9kaXY+" style="min-height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div></div>