I've been looking to write a lexer in Haskell and stumbled upon these functions.
If defined,
someandmanyshould be the least solutions of the equations:
some v = (:) <$> v <*> many v
many v = some v <|> pure []
I get that the (:) in some gets lifted and applied to the value of v in order to prepend it to the list returned in many v.
But why does the definition of many start with some? And why does it get concatenated with pure []?
What is the relationship or difference between these two functions? What does it mean for some and many to be the least solutions of those equations? And how does the recursion ever stop? Help!