@@ -28,12 +28,12 @@ import Data.String.Regex.Flags (RegexFlags(..), RegexFlagsRec)
2828-- | Wraps Javascript `RegExp` objects.
2929foreign import data Regex :: Type
3030
31- foreign import showRegex' :: Regex -> String
31+ foreign import showRegexImpl :: Regex -> String
3232
3333instance showRegex :: Show Regex where
34- show = showRegex'
34+ show = showRegexImpl
3535
36- foreign import regex'
36+ foreign import regexImpl
3737 :: (String -> Either String Regex )
3838 -> (Regex -> Either String Regex )
3939 -> String
@@ -43,17 +43,17 @@ foreign import regex'
4343-- | Constructs a `Regex` from a pattern string and flags. Fails with
4444-- | `Left error` if the pattern contains a syntax error.
4545regex :: String -> RegexFlags -> Either String Regex
46- regex s f = regex' Left Right s $ renderFlags f
46+ regex s f = regexImpl Left Right s $ renderFlags f
4747
4848-- | Returns the pattern string used to construct the given `Regex`.
4949foreign import source :: Regex -> String
5050
5151-- | Returns the `RegexFlags` used to construct the given `Regex`.
5252flags :: Regex -> RegexFlags
53- flags = RegexFlags <<< flags'
53+ flags = RegexFlags <<< flagsImpl
5454
5555-- | Returns the `RegexFlags` inner record used to construct the given `Regex`.
56- foreign import flags' :: Regex -> RegexFlagsRec
56+ foreign import flagsImpl :: Regex -> RegexFlagsRec
5757
5858-- | Returns the string representation of the given `RegexFlags`.
5959renderFlags :: RegexFlags -> String
@@ -101,7 +101,10 @@ foreign import replace :: Regex -> String -> String -> String
101101-- | Transforms occurences of the `Regex` using a function of the matched
102102-- | substring and a list of submatch strings.
103103-- | See the [reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_function_as_a_parameter).
104- foreign import replace' :: Regex -> (String -> Array String -> String ) -> String -> String
104+ replace' :: Regex -> (String -> Array String -> String ) -> String -> String
105+ replace' = replaceBy
106+
107+ foreign import replaceBy :: Regex -> (String -> Array String -> String ) -> String -> String
105108
106109foreign import _search
107110 :: (forall r . r -> Maybe r )
0 commit comments