What are Alternative's "some" and "many" useful for?
alternative-functor, applicative, haskell, some-and-many
Solution
I tend to see them in `Applicative` parser combinator libraries.
a :: Parser [String]
a = some (string "hello")
and I see `many` used for purpose in the default definitions of `Parsing` in `parsers`.
I think Parsec being the primary example of a parser combinator library hides the use of `some`/`many` since it redefines things like `(<|>)`.
Problem
`Alternative`, an extension of `Applicative`, declares `empty`, `<|>` and these two functions: One or more: ``` some :: f a -> f [a] ``` Zero or more: ``` many :: f a -> f [a] ``` If defined, `some` and `many` should be the least solutions of the equations: ``` some v = (:) <$> v <*> many v many v = some v <|> pure [] ``` I couldn't find an instance for which `some` and `many` are defined. What is their meaning and practical use? Are they used at all? I've been unable to grasp their purpose just from this definition. Update: I'm not asking what is `Alternative`, just what are `some` and `many`