[Haskell-cafe] [Alternative] some/many narrative

Bryan O'Sullivan bos at serpentine.com
Thu Dec 15 18:34:14 CET 2011


On Wed, Dec 14, 2011 at 10:29 PM, Chris Wong <
chrisyco+haskell-cafe at gmail.com> wrote:

>    -- [Warning]: This is only defined for actions that eventually fail
>    -- after being performed repeatedly, such as parsing. For pure values
> such
>    -- as 'Maybe', this will cause an infinite loop.
>

This is both confusing and incorrect. It's entirely possible for an action
in the Maybe type to fail.

For the Maybe type, "failing" means an action returns Nothing, and
"succeeding" means an action returns Just (some value).

If an action of type Maybe a is written to always and unconditionally
return Just some-value-or-other, *that's* when some or many will
infinite-loop if used with it. That doesn't mean there's something wrong
with the definitions of some or many, but rather that they need to be
supplied with an action that will at some point fail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111215/fadf5a3d/attachment.htm>


More information about the Haskell-Cafe mailing list