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 8686
8787 flags :: Regex -> RegexFlags
8888
89- match :: Regex -> String -> [String]
89+ match :: Regex -> String -> Maybe [String]
9090
9191 parseFlags :: String -> RegexFlags
9292
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ module Data.String.Regex (
1414 split
1515 ) where
1616
17+ import Data.Function
18+ import Data.Maybe
1719import Data.String (indexOf )
1820
1921foreign import data Regex :: *
@@ -84,12 +86,14 @@ foreign import test
8486 \ };\
8587 \}" :: Regex -> String -> Boolean
8688
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
9397
9498foreign import replace
9599 " function replace(r) {\
You can’t perform that action at this time.
0 commit comments