lens-regex-0.1.0: Lens powered regular expression

Safe HaskellNone




r :: QuasiQuoter Source

Generate compiled regular expression.

This QuasiQuote is shorthand of makeRegex with type annotations:

[r|hogehoge|] == (makeRegex ("hogehoge" :: String) :: Regex)

The Regex type signature in the above example, is the type which is named as Regex in this translation unit. Therefore, you can choose Regex type by changing imports.

For example, the exp variable in the below example has the type of Text.Regex.Posix.Regex:

import Text.Regex.Posix (Regex)
exp = [r|hoge|]

and, the exp variable in below example has the type of Text.Regex.PCRE.Regex:

import Text.Regex.PCRE (Regex)
exp = [r|hoge|]