liveBook · Manning

skipMany1

As explained in Learn Haskell by Example

skipMany1 is an Attoparsec combinator that applies a parser at least once and discards all parsed results.

skipMany1 is an Attoparsec combinator that applies a parser at least once, then discards every parsed result. It is useful when input must contain one or more matching characters but their values are irrelevant. section 12.2.2

Require and discard whitespace

Define a whitespace parser that returns (), then require at least one occurrence: `whitespace = void (C8.satisfy isWhitespace)` and `whitespaces = skipMany1 whitespace`. A PNM header can use `whitespace` where exactly one separator is required and `whitespaces` where one or more separators must occur.

How Learn Haskell by Example covers it

How deep it goes
Defines the combinator and demonstrates its implementation, but does not examine its internal mechanics.
Examples
Uses a PNM whitespace parser that recognizes spaces, newlines, tabs, carriage returns, vertical tabs, and form feeds.
What you can do after
Apply it via Attoparsec to require and discard one or more matching input elements.
How it connects
Connects skipMany1 with Parser, satisfy, void, whitespace parsing, and Attoparsec header parsing.

Related concepts

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.