Arithmetic of String.Pos.Raw #
This file contains basic theory about which does not actually need to know anything about strings
and therefore does not depend on Init.Data.String.Decode.
Equations
Instances For
Returns the size of the byte slice delineated by the positions lo and hi.
Equations
Instances For
Offsets p by offset on the left. This is not an HAdd instance because it should be a
relatively rare operation, so we use a name to make accidental use less likely. To offset a position
by the size of a character character c or string s, you can use c + p resp. s + p.
This should be seen as an operation that converts relative positions into absolute positions.
See also Pos.Raw.increaseBy, which is an "advancing" operation.
Equations
Instances For
Decreases p by offset. This is not an HSub instance because it should be a relatively
rare operation, so we use a name to make accidental use less likely. To unoffset a position
by the size of a character c or string s, you can use p - c resp. p - s.
This should be seen as an operation that converts absolute positions into relative positions.
See also Pos.Raw.decreaseBy, which is an "unadvancing" operation.
Equations
Instances For
Advances p by n bytes. This is not an HAdd instance because it should be a relatively
rare operation, so we use a name to make accidental use less likely. To add the size of a
character c or string s to a raw position p, you can use p + c resp. p + s.
This should be seen as an "advance" or "skip".
See also Pos.Raw.offsetBy, which turns relative positions into absolute positions.
Equations
Instances For
Move the position p back by n bytes. This is not an HSub instance because it should be a
relatively rare operation, so we use a name to make accidental use less likely. To remove the size
of a character c or string s from a raw position p, you can use p - c resp. p - s.
This should be seen as the inverse of an "advance" or "skip".
See also Pos.Raw.unoffsetBy, which turns absolute positions into relative positions.
Equations
Instances For
Increases the byte offset of the position by 1. Not to be confused with Pos.next.
Equations
Instances For
Decreases the byte offset of the position by 1. Not to be confused with Pos.prev.
Equations
Instances For
Returns either p₁ or p₂, whichever has the least byte index.