haskell - What are Alternative's "some" and "many" useful for? -
alternative, extension of applicative, declares empty, <|> , these 2 functions:
one or more:
some :: f -> f [a]zero or more:
many :: f -> f [a]if defined,
some,manyshould least solutions of equations:some v = (:) <$> v <*> many v many v = v <|> pure []
i couldn't find instance some , many defined. what meaning , practical use? used @ all? i've been unable grasp purpose definition.
update: i'm not asking alternative, some , many
i tend see them in applicative parser combinator libraries.
a :: parser [string] = (string "hello") and see many used purpose in default definitions of parsing in parsers.
i think parsec being primary example of parser combinator library hides use of some/many since redefines things (<|>).
Comments
Post a Comment