RegexContext

class RegexLike regex source => RegexContext regex source target
regex-base Text.Regex.Base.RegexLike
RegexContext is the polymorphic interface to do matching. Since target is polymorphic you may need to suply the type explicitly in contexts The monadic matchM version uses fail to report when the regex has no match in source. Two examples: Here the contest Bool is inferred: > [ c | let notVowel = makeRegex "[^aeiou]" :: Regex, c <- ['a'..'z'], match notVowel [c] ] > > "bcdfghjklmnpqrstvwxyz" Here the context '[String]' must be supplied: > let notVowel = (makeRegex "[^aeiou]" :: Regex ) > in do { c <- ['a'..'z'] ; matchM notVowel [c] } :: [String] > > ["b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"]