Closed dotnetCarpenter closed 1 year ago
Looking at the new documentation but still unsure what is the expected return type. ? Is it always suppose to be:
Maybe ([Maybe (String)])
Right, so upon re-reading the new documentation I finally got it!
Takes a pattern and a string, and returns Just an array of captured values if the pattern matches the string; Nothing otherwise.
So the regex MUST contain at least one capture group.
In Sanctuary 3.1.0 the following used to work:
But the behavior has changed in commit 0b5611700978861b23bccf3f714771d1b61ffa14.
Now, the following returns
Just ([])
and the above throws an error because there is nomatch
property.The test is here: https://github.com/sanctuary-js/sanctuary/blob/72bc20ad02c5944b661efdcdd14ab60ceb92c7b3/test/match.js