[Haskell-cafe] Splitting off many/some from Alternative

Bryan O'Sullivan bos at serpentine.com
Mon Dec 12 18:32:04 CET 2011


On Mon, Dec 12, 2011 at 9:23 AM, Carl Howells <chowells79 at gmail.com> wrote:

> > There is absolutely no implication of consuming anything in the
> definitions
> > of many or some. This is how they happen to behave when used in the
> context
> > of some parsing libraries, but that's all. If many or some always go
> into an
> > infinite loop for some Alternative instance, then I suspect that the
> > instance itself is either broken or shouldn't exist.
>
> So, then...  The instance for Maybe shouldn't exist?
>

Don't be silly. The purpose of some and many is to be used with combinators
that are expected to fail sometimes. If you use them with combinators that
always succeed, of course you're going to get an infinite loop. Would you
propose to ban recursive functions because they might not terminate?

Apparently the confusion here lies with the fact that the documentation for
some and many are too terse for their behaviour to be easily understood.
That's a whole different category of problem than "ban them!".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111212/22ecb4b8/attachment.htm>


More information about the Haskell-Cafe mailing list