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 , many should 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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -