You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I guess if you want to be specific, it should take a new type, and we should expose functions for building that type according to the syntax or something. I personally don't care enough to do that 😅
it should take a new type, and we should expose functions for building that type according to the syntax or something
This would be nice, actually. Not only would it make it easier to use the magic patterns by name instead of having to look them up every time, but it would also allow consumers to not worry about having to escape $ if they're trying to include a literal $ in their replacement. I think it's worth it.
If wanted to give consumers an unsafe out to avoid having to build up a sequence of these "replacement parts", you could have a function that parses a replacement string into the sequence for them automagically. Seems like you get the best of both worlds that way.
Right now the signature of replace on regex is:
foreign import replace :: Regex -> String -> String -> String
and I argue it should be
foreign import replace :: Regex -> Replacement -> String -> String
Of course this would be breaking so potentially there should be an alternative under a different name and the old one could be made deprecated.
What do you think?
The text was updated successfully, but these errors were encountered: