File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 86
86
87
87
flags :: Regex -> RegexFlags
88
88
89
- match :: Regex -> String -> [String]
89
+ match :: Regex -> String -> Maybe [String]
90
90
91
91
parseFlags :: String -> RegexFlags
92
92
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ module Data.String.Regex (
14
14
split
15
15
) where
16
16
17
+ import Data.Function
18
+ import Data.Maybe
17
19
import Data.String (indexOf )
18
20
19
21
foreign import data Regex :: *
@@ -84,12 +86,14 @@ foreign import test
84
86
\ };\
85
87
\}" :: Regex -> String -> Boolean
86
88
87
- foreign import match
88
- " function match(r) {\
89
- \ return function (s) {\
90
- \ return s.match(r); \
91
- \ };\
92
- \}" :: Regex -> String -> [String ]
89
+ foreign import _match
90
+ " function _match(r, s, Just, Nothing) {\
91
+ \ var m = s.match(r);\
92
+ \ return m == null ? Nothing : Just(m);\
93
+ \}" :: forall r . Fn4 Regex String ([String ] -> r ) r r
94
+
95
+ match :: Regex -> String -> Maybe [String ]
96
+ match r s = runFn4 _match r s Just Nothing
93
97
94
98
foreign import replace
95
99
" function replace(r) {\
You can’t perform that action at this time.
0 commit comments