Hoogle Search
Within LTS Haskell 24.69 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
getOffset :: MonadParsec e s m => m Intmegaparsec Text.Megaparsec Get the number of tokens processed so far. See also: setOffset.
-
megaparsec Text.Megaparsec The expression parseTest p input applies the parser p on the input input and prints the result to stdout. Useful for testing.
pstateOffset :: PosState s -> !Intmegaparsec Text.Megaparsec Offset corresponding to beginning of pstateInput
stateOffset :: State s e -> {-# UNPACK #-} !Intmegaparsec Text.Megaparsec Number of processed tokens so far
errorOffset :: ParseError s e -> Intmegaparsec Text.Megaparsec.Error Get the offset of a ParseError.
pstateOffset :: PosState s -> !Intmegaparsec Text.Megaparsec.State Offset corresponding to beginning of pstateInput
stateOffset :: State s e -> {-# UNPACK #-} !Intmegaparsec Text.Megaparsec.State Number of processed tokens so far
reachOffset :: TraversableStream s => Int -> PosState s -> (Maybe String, PosState s)megaparsec Text.Megaparsec.Stream Given an offset o and initial PosState, adjust the state in such a way that it starts at the offset. Return two values (in order):
- Maybe String representing the line on which the given offset o is located. It can be omitted (i.e. Nothing); in that case error reporting functions will not show offending lines. If returned, the line should satisfy a number of conditions that are described below.
- The updated PosState which can be in turn used to locate another offset o' given that o' >= o.
- It should adequately represent location of token at the offset of interest, that is, character at sourceColumn of the returned SourcePos should correspond to the token at the offset o.
- It should not include the newline at the end.
- It should not be empty, if the line happens to be empty, it should be replaced with the string "<empty line>".
- Tab characters should be replaced by appropriate number of spaces, which is determined by the pstateTabWidth field of PosState.
reachOffsetNoLine :: TraversableStream s => Int -> PosState s -> PosState smegaparsec Text.Megaparsec.Stream A version of reachOffset that may be faster because it doesn't need to fetch the line at which the given offset in located. The default implementation is this:
reachOffsetNoLine o pst = snd (reachOffset o pst)
Note: type signature of the function was changed in the version 8.0.0.-
extra Extra Call once to start, then call repeatedly to get the elapsed time since the first call. The time is guaranteed to be monotonic. This function is robust to system time changes.
do f <- offsetTime; xs <- replicateM 10 f; pure $ xs == sort xs