úΉ‡°       Safe-InferredApplicative regex (Text.Regex.ApplicativeL) which takes position-tagged symbols and returns a position-tagged result.!A value with a position attached.!Represents an advancement of the next available positionm marker due to reading a character. For example, the letter A moves forward by one column, while linefeed ('\n'*) moves to the beginning of the next line.'The character type is a type parameter.ÿZAn advance includes a pattern and a change. The pattern determines to which characters, or character sequences, this advance applies. The change determines how to advance the position in the pattern is matched. It can also choose different advances depending on the match, e.g. "move 1 column if matched "a" and move 4 columns if matched "t".ÁRepresents a position in a text. The intended usage is holding the next available position in a file. In other words: If a character would be appended to the file, what its position would be."Line number, start counting from 1$Column number, start counting from 1RCharacter index (count of characters in the file so far), start counting from 1   Safe-Inferred tThe position before the first character in a file, to be used as an initial value before reading actual characters. .The position of the first character in a file. zThe zero advance. It doesn't match any input and doesn't consume any characters. Applying it doesn't change the position. øThe default advance when reading a character, e.g. a letter or a digit. The new character would have column number higher by 1, and character index higher by once (advances by 1 for each character read). The pattern accepts any single character. >Create an advance for a single character based on a predicate.*Create an advance for the given character.§Create an advance for a line character with the specified width. This is mainly useful for tabs and perhaps the various space characters in Unicode. Example for tab: tabAdv = linecharAdvance '\t' 83Create an advance for the given character sequence.”Create an advance for a character or sequence of characters expressing a newline, i.e. starting a new line. As the advance expresses the position afterJ the character, applying the advance results with a position at column 1.dCreate a set of common advances supporting tabs and newlines. More advances can easily be added by  |Hing them to the result. The result doesn't include the default advance.®Concatenate two advances into a single advance accepting their patterns in order, and applying the advances on top of each other. For example, concatenating an advance for a and an advance for b$ results with an advance accepting "ab"+ and moving the position 2 columns forward.ÍGiven a list of remaining characters to read, the next position in the file and a set of advance rules, try to consume characters once and determine what is the next position after reading them. Example:0tryAdvance defaultAdvance (Position 1 1 1) "abc"(Position 1 2 2,"bc")mIf there is no match, it returns the input position and the input list, i.e. no characters will be consumed.Like K, but reads one character at most. In the general case you'll want to use  , because $ breaks chains. For example, while  can recognize "rn" as a single newline,  will consume only the '\r'(, splitting the string into 2 newlines.5If there is no match, the input position is returned.½Given a list of remaining characters to read, the next position in the file and a set of advance rules, consume characters once and determine what is the next position after reading them.The   is appended (using  é) to the given advance. Therefore, if the given list isn't empty, at leat character will be consumed. The intended use is to encode all the special cases (tab, newlines, non-spacing marks, etc.) in the given advance, and let the   catch the rest.Like g, but reads exactly one character. Patterns which require more than one character fail to match. Like , but has the  B appended, which means is always consumes given a non-empty list.ÿGiven the next position and a list matched there, annotate the symbols with position information. For a single character, it is simply the given position. For a sequence, this annotation assigns all the symbols the same line and column, incrementing only the character index.$defaultAnnotate (Position 1 1 1) "a"![Positioned 'a' (Position 1 1 1)]'defaultAnnotate (Position 1 1 1) "\r\n"D[Positioned '\r' (Position 1 1 1), Positioned '\n' (Position 1 1 2)]UThe last example would give the same positions to any list of the same length, e.g. "ab" instead of "rn".êGiven an advance rule, the next available position and a symbol list, consume symbols once. Return a list of them, annotated with position information, as well as the next position and the rest of the input. On empty input, return [](, the given position and the input list.ˆIf more than one character is matched, the sequence is annotated with consecutive character indices, but with the same line and column.?enrichOnce (newlineAdvance "\r\n") (Position 1 1 1) "\r\nhello"$( [ Positioned '\r' (Position 1 1 1)$ , Positioned '\n' (Position 1 1 2) ], Position 2 1 3 , "hello")ùGiven an advance rule, the next available position and a symbol list, try to consume symbols once. If consumed, return a list of them, annotated with position information, as well as the next position and the rest of the input. Otherwise, return [](, the given position and the input list.sIf more than one character is matched, the sequence is annotated using the function passed as the first parameter.&let ann = defaultAnnotate; adv = emptyHenrichOnceD ann adv (newlineAdvance "\r\n") (Position 1 1 1) "\r\nhello"$( [ Positioned '\r' (Position 1 1 1)$ , Positioned '\n' (Position 1 1 2) ], Position 2 1 3 , "hello")ÿ%Given a list of symbols, annotate it with position based on advance rules. Each symbol is annotated with its position in the text. In addition to the annotated list, the next available position is returned (i.e. the position of the next symbol, if another symbol were appended to the list).enrich defaultAdvance "abc"$( [ Positioned 'a' (Position 1 1 1))$ , Positioned 'b' (Position 1 2 2)) ], Position 1 3 3)It is implemented using the  8 as a default, i.e. the entire list is always consumed.Like ™, but takes an annotation function as the first parameter, and a default advance as the second parameter. The rest of the parameters are the same ones K takes. It allows using custom defaults. To have no default advance, pass !.¸Since a match of the whole list isn't guaranteed, there is an additional list in the return type, containing the rest of the input. If the entire input is matched, that list will be []8. If no input is matched at all, the annotated list is [], the position is  < and the additional list (rest of input) is the input list.“Given a regex, create an equivalent position-aware regex. The resulting regex reads position-tagged symbols, and returns a position-tagged result.ƒTokenize an input list and get list of tokens. If there was an error (no regex match), get the text position at which it happened.=Get some numbers describing the given text (list of symbols):The total number of lines/The length (number of columns) of the last lineThe total number of charactersÏNote that this probably isn't the fastest implementation. It's possible to compute directly by counting the lines and the characters. This function is here anyway, as a demonstration of using this library.-let adv = commonAdvance 4 True True True True5textInfo adv "Hello world!\nHow are you?\nWonderful!" (3,11,36)  The character$How many columns the character takesTab width (usually 2, 4 or 8)0Whether carriage return (CR) counts as a newline)Whether linefeed (LF) counts as a newline.Whether the sequence CR LF counts as a newline)Whether formfeed (FF) counts as a newlineannotation functiondefault advance advance ruleinitial position input list5Advance rule for position tagging, e.g. made with .Regex which selects and returns a single tokenInput list of symbolsRList of tokens matched. If the entire input was matched, the second element is "O. Otherwise, it is the (position-tagged) symbol at which matching failed.   Safe-Inferred    #      !"#$"#%"&'(text-position-0.1.0.0 Data.PositionData.Position.TypesData.Position.InterfacePosRE PositionedAdvancePositionlinecolumnchar zeroPosition firstPosition emptyAdvancedefaultAdvance psymAdvance symAdvancelinecharAdvance stringAdvancenewlineAdvance commonAdvance<++> tryAdvance tryAdvanceCadvanceadvanceCdefaultAnnotate enrichOnce enrichOnceDenrichenrichDblesstokenstextInfobaseControl.Applicative<|>empty Data.MaybeNothing