regex-base-0.72.0.1: Replaces/Enhances Text.RegexContentsIndex
Text.Regex.Base.Context
Portabilitynon-portable (MPTC+FD)
Stabilityexperimental
Maintainerlibraries@haskell.org, textregexlazy@personal.mightyreason.com
Description

This is a module of instances of RegexContext. Nothing else is exported. These work for all the front ends and backends interchangably. These instances are important because they provide the different results that can be gotten from a match or matchM operation (often via the =~ and =~~ operators). The name is Context because they are context dependent: use them in a context that expects an Int and you get a count of matches, use them in a Bool context and get True if there is a match, etc.

 
type MatchArray = Array Int (MatchOffset, MatchLength)
type MatchText source = Array Int (source, (MatchOffset, MatchLength))

These are for the first match:

( RegexLike a b => RegexContext a b Bool ) : Whether there is any match or not

( RegexLike a b => RegexContext a b () ) : Useful using =~~ in a monad, since failure to match is via fail

( RegexLike a b => RegexContext a b (MatchOffset,MatchLength) ) : This returns the initial index and length of the whole match. Starting at (-1) indicates failure to match.

( RegexLike a b => RegexContext a b b ) : This returns the text of the whole match. It will return empty from Extract if there is no match. These are defined in other modules, but documented here for convenience.

( RegexLike a b => RegexContext a b MatchArray ) : Where each sub-part the match starts and its length. Starting at (-1) indicates unused.

( RegexLike a b => RegexContext a b (Array Int b) ) : The text of each sub-part of the match. Unused matches are empty (defined via Extract)

( RegexLike a b => RegexContext a b (b, MatchText b, b) ) : The text before the match, the details of the match, and the text after the match

( RegexLike a b => RegexContext a b (b, b, b) ) : The text before the match, the text of the match, the text after the match

( RegexLike a b => RegexContext a b (b, b, b, [b]) ) : The text before the match, the text of the match, the text after the match, and the text of the 1st and higher sub-parts of the match. This is the same return value as used in Text.Regex.

( RegexLike a b => RegexContext a b (MatchResult b) ) : The MatchResult structure for the match.

These instances are for all the matches (non-overlapping):

( RegexLike a b => RegexContext a b Int ) : The number of matches

These instances similar to the single match ones above, but in a List:

( RegexLike a b => RegexContext a b [(MatchOffset, MatchLength)] ) :

( RegexLike a b => RegexContext a b [b] ) : As a policy, I chose [b] to be the list of whole text of each match.

( RegexLike a b => RegexContext a b [MatchArray] ) :

( RegexLike a b => RegexContext a b [Array Int b] ) :

( RegexLike a b => RegexContext a b [MatchText b] ) :

( RegexLike a b => RegexContext a b [[b]] ) : This is the list of the list of the text of the sub-part of each match. Unused matches are empty (defined via Extract)

Produced by Haddock version 0.8