liveBook · Manning

Whitespace character

As explained in Learn Haskell by Example

Whitespace is text consisting of spacing characters that separate or format other characters.

Whitespace consists of spacing characters used to separate values or format structured text. In the PNM image format, it includes spaces, newlines, carriage returns, form feeds, vertical tabs, and tabs. section 12.2.2

A parser handles whitespace by:

  • Testing each character with satisfy and discarding the result with void. section 12.2.2
  • Using skipMany1 when at least one whitespace character must occur. section 12.2.2
  • Skipping whitespace repeatedly between PNM header fields. section 12.2.2

Skipping whitespace and comments

A PNM header can ignore either comments or one-or-more whitespace characters, recursively continuing until the next meaningful value.

How Learn Haskell by Example covers it

How deep it goes
Defines six accepted characters and implements optional or required skipping, stopping short of broader text classification.
Examples
Demonstrates character predicates, skipMany1, recursive comment skipping, and PNM header parsing.
What you can do after
Builds a parser that recognizes, requires, and ignores whitespace while reading PNM headers.
How it connects
Connects whitespace with parsing, comments, Attoparsec, and the PNM format.

Also explained in

Compare how 3 books explain whitespace character →

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.