liveBook · Manning

Some

As explained in Learn Haskell by Example

some is an Alternative operation that applies an applicative computation one or more times and collects the successful results.

some repeatedly applies an Alternative computation and collects its results, requiring at least one successful application. A failure before any success produces failure. section 12.1.4

Parsing repeated input

runParser (some $ string "A") "AAA" returns three parsed strings, while running it on an empty input returns a parsing error.

How Learn Haskell by Example covers it

How deep it goes
Defines the operation through Alternative and demonstrates successful repetition, empty-input failure, and a practical parser.
Examples
Demonstrates repeated A parsing, failed empty-input parsing, and a parser for one or more spaces.
What it assumes
Assumes Applicative and Alternative concepts, while demonstrating their failure and repetition behavior with Parser.
What you can do after
Apply it via Control.Applicative to parse one-or-more repeated inputs.
How it connects
Connects Alternative with Applicative, many, (<|>), pure, and Parser.

This explainer was generated by Manning's knowledge graph from the text of Learn Haskell by Example. The section links point to the parts of the book it draws on.