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
andmany
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
I tend to see them in
Applicative
parser combinator libraries.and I see
many
used for purpose in the default definitions ofParsing
inparsers
.I think Parsec being the primary example of a parser combinator library hides the use of
some
/many
since it redefines things like(<|>)
.