Skip to content

update match to reflect the existence of optional capturing groups #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2015

Conversation

davidchambers
Copy link
Contributor

Closes #31

Suggestions as to how to test this change would be appreciated. :)

list.push(m[i] == null ? Nothing : Just(m[i]));
}
return Just(list);
}
}
""" :: forall r. Fn4 Regex String ([String] -> r) r r
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It think we should fix this type signature now, since we are actually using Nothing and Just at two different instantiations:

Fn4 Regex String (forall r. r -> Maybe r) (forall r. Maybe r) (Maybe (Maybe r))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Updated. :)

@paf31
Copy link
Contributor

paf31 commented May 19, 2015

👍 @garyb?

@davidchambers
Copy link
Contributor Author

The command "npm install && bower install" failed and exited with 1 during .

garyb added a commit that referenced this pull request May 19, 2015
update match to reflect the existence of optional capturing groups
@garyb garyb merged commit 6d66332 into purescript:master May 19, 2015
@garyb
Copy link
Member

garyb commented May 19, 2015

Thanks @davidchambers 👍. Don't worry about the Travis error, master is being updated for 0.7 and currently has dependencies on versions that don't exist yet - we're going to release all the core libraries together in one batch.

@davidchambers davidchambers deleted the match branch May 19, 2015 15:46
@davidchambers
Copy link
Contributor Author

In sanctuary-js/sanctuary#253 @rjmk pointed out that one of the members of Maybe [Maybe String] is Just [Nothing], which is meaningless in this context. Ideally the return type would not permit any meaningless values.

Are you interested in the changes I've just proposed in sanctuary-js/sanctuary#283? Essentially:

match :: NonGlobalRegExp -> String -> Maybe { match :: String, groups :: Array (Maybe String) }
matchAll :: GlobalRegExp -> String -> Array { match :: String, groups :: Array (Maybe String) }

If you think these types are more appropriate in a PureScript context as well I'll submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

consider optional capturing groups in match
3 participants