Const
When someone said withIndent earlier, what number did they put in there?
getIndent()
0
withInden(4)(getIndent())
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:
withIndent
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!
col
When someone said withIndent earlier, what number did they put in there?
getIndent()
results in0
, the default valuewithInden(4)(getIndent())
results in4
So you are just asking about things you said earlier. These numbers do not leak out of withIndent, so say we have:
withIndent
is addative: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