On 15 December 2011 06:29, Chris Wong <[email protected]> wrote:

> class (Applicative f, Monoid f) => Alternative f where
>    -- | Keep repeating the action (consuming its values) until it
> fails, and then return the values consumed.

I think this should be "collect" rather than "consume" and you can
omit the parentheses.  I also think that we should include the
original definition, which is more formally precise (although it could
use with some examples).

>    --
>    -- [Warning]: This is only defined for actions that eventually fail

Perhaps add the remark that we expect non-deterministic actions.

>    -- after being performed repeatedly, such as parsing. For pure values such
>    -- as 'Maybe', this will cause an infinite loop.
>    some :: f a -> f [a]
>    some v = ...
>
>    -- | Similar to 'many', but if no values are consumed it returns
> 'empty' instead of @f []@.
>    --
>    -- [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.
>    many :: f a -> f [a]
>    many v = ...
>
> Warnings are repeated for emphasis :)
>
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe



-- 
Push the envelope. Watch it bend.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to