On Dec 13, 2011, at 3:32 AM, Bryan O'Sullivan wrote:
> 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.
Yes, but how can someone using a typeclass *know* whether a type has values
that will always succeed?
> 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!".
Nobody has been calling for them to be banned at all --- or at least, I
haven't, and I am the one who has started the thread. :-) What we (if I may
be so bold as to use the royal we here :-) ) would like would be for these
methods to be moved into a separate class. This way users of the classes will
know whether their type has well-defined instance for some and many or not.
Or, alternatively, we could add documentation making it clear that one should
*only* make a type be an instance of Applicative *if* all values of that type
will eventually fail in combination, thus ensuring that some and many will
always be well defined. Thus, in particular, Maybe would no longer be a
well-formed instance of this type, though we might decide to keep it around
anyway in order to avoid breaking old code.
Cheers,
Greg
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe