Const
This is a more efficient version of getPosition.map(t => t[1]). This can be useful in combination with withIndent and getIndent, like this:
getPosition.map(t => t[1])
const checkIndent: P.Parser<P.Unit> = P.succeed( (indent: number) => (column: number) => indent <= column ) .apply(P.getIndent) .apply(P.getCol) .andThen((isIdented) => { if (isIdented) { return P.succeed(P.Unit); } else { return P.problem("expecting more spaces"); } });
So the checkIndent parser only succeeds when you are "deeper" than the current indent level.
checkIndent
This is a more efficient version of
getPosition.map(t => t[1])
. This can be useful in combination with withIndent and getIndent, like this:So the
checkIndent
parser only succeeds when you are "deeper" than the current indent level.