Type of regular expressions that recognize symbols of type s and
produce a result of type a.
Regular expressions can be built using Functor, Applicative, Alternative, and Filtrable instances in the following natural way:
f<$>ramatches ifframatches, and its return value is the result of applyingfto the return value ofra.pure
xmatches the empty string (i.e. it does not consume any symbols), and its return value isxrf<*>ramatches a string iff it is a concatenation of two strings: one matched byrfand the other matched byra. The return value isf a, wherefandaare the return values ofrfandrarespectively.ra<|>rbmatches a string which is accepted by eitherraorrb. It is left-biased, so if both can match, the result ofrais used.empty is a regular expression which does not match any string.
many
ramatches concatenation of zero or more strings matched byraand returns the list ofra's return values on those strings.some
ramatches concatenation of one or more strings matched byraand returns the list ofra's return values on those strings.catMaybes
rammatches ifframmatches and produces 'Just _'.ra<>rbmatchesrafollowed byrb. The return value isa <> b, whereaandbare the return values ofraandrbrespectively. (See https://github.com/feuerbach/regex-applicative/issues/37#issue-499781703 for an example usage.)mempty matches the empty string (i.e. it does not consume any symbols), and its return value is the mempty value of type
a.
Instances7Functor, Applicative, Alternative, Filtrable, IsString, Semigroup, …
Functor (RE s)Defined in regex-applicative-0.3.4 · Text.Regex.Applicative.TypesApplicative (RE s)Defined in regex-applicative-0.3.4 · Text.Regex.Applicative.TypesAlternative (RE s)Defined in regex-applicative-0.3.4 · Text.Regex.Applicative.TypesFiltrable (RE s)Defined in regex-applicative-0.3.4 · Text.Regex.Applicative.Types(char ~ Char, string ~ String) => IsString (RE char string)Defined in regex-applicative-0.3.4 · Text.Regex.Applicative.TypesSemigroup a => Semigroup (RE s a)Defined in regex-applicative-0.3.4 · Text.Regex.Applicative.TypesMonoid a => Monoid (RE s a)Defined in regex-applicative-0.3.4 · Text.Regex.Applicative.Types