Variable getIndentConst

getIndent: Simple.Parser<number> = A.getIndent

When someone said withIndent earlier, what number did they put in there?

  • getIndent() results in 0, the default value
  • withInden(4)(getIndent()) results in 4

So you are just asking about things you said earlier. These numbers do not leak out of withIndent, so say we have:

    succeed((a: number) => (b: number) => [a, b])
.apply(withIndent(4)(getIndent))
.apply(getIndent); // => [4,0]

withIndent is addative:

   const parser = P.succeed((x: number) => (y: number) => [x, y])
.apply(P.withIndent(8)(P.withIndent(4)(P.getIndent)))
.apply(withIndent(4)(getIndent))
// => [8, 4]

This is really nice because it means that someone else can tell us what our indentation level is. If we then do any comparisons against col it will check out!

See