@@ -28,12 +28,12 @@ import Data.String.Regex.Flags (RegexFlags(..), RegexFlagsRec)
28
28
-- | Wraps Javascript `RegExp` objects.
29
29
foreign import data Regex :: Type
30
30
31
- foreign import showRegex' :: Regex -> String
31
+ foreign import showRegexImpl :: Regex -> String
32
32
33
33
instance showRegex :: Show Regex where
34
- show = showRegex'
34
+ show = showRegexImpl
35
35
36
- foreign import regex'
36
+ foreign import regexImpl
37
37
:: (String -> Either String Regex )
38
38
-> (Regex -> Either String Regex )
39
39
-> String
@@ -43,17 +43,17 @@ foreign import regex'
43
43
-- | Constructs a `Regex` from a pattern string and flags. Fails with
44
44
-- | `Left error` if the pattern contains a syntax error.
45
45
regex :: 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
47
47
48
48
-- | Returns the pattern string used to construct the given `Regex`.
49
49
foreign import source :: Regex -> String
50
50
51
51
-- | Returns the `RegexFlags` used to construct the given `Regex`.
52
52
flags :: Regex -> RegexFlags
53
- flags = RegexFlags <<< flags'
53
+ flags = RegexFlags <<< flagsImpl
54
54
55
55
-- | Returns the `RegexFlags` inner record used to construct the given `Regex`.
56
- foreign import flags' :: Regex -> RegexFlagsRec
56
+ foreign import flagsImpl :: Regex -> RegexFlagsRec
57
57
58
58
-- | Returns the string representation of the given `RegexFlags`.
59
59
renderFlags :: RegexFlags -> String
@@ -101,7 +101,10 @@ foreign import replace :: Regex -> String -> String -> String
101
101
-- | Transforms occurences of the `Regex` using a function of the matched
102
102
-- | substring and a list of submatch strings.
103
103
-- | 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
105
108
106
109
foreign import _search
107
110
:: (forall r . r -> Maybe r )
0 commit comments