Skip to content
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

Create an Alternative trait #27

Open
tmciver opened this issue Nov 28, 2017 · 0 comments
Open

Create an Alternative trait #27

tmciver opened this issue Nov 28, 2017 · 0 comments

Comments

@tmciver
Copy link
Owner

tmciver commented Nov 28, 2017

In Haskell Alternative looks like this: https://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Applicative.html#t:Alternative. I think the way that I'd cast this in PHP is with the following trait:

trait Alternative {
  use Applicative;

  function or($otherAlternative);
  function zeroOrMore(); // I think this name is more intuitive than `many`
  function oneOrMore();  // I think this name is more intuitive than `some`
}
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

No branches or pull requests

1 participant