Skip to content

Create an Alternative trait #27

@tmciver

Description

@tmciver

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`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions