Skip to content

4.1: Full Blown Applicative

Compare
Choose a tag to compare
@gfontenot gfontenot released this 07 Jun 19:36
· 30 commits to main since this release
e1bb1f7

This release fleshes out the rest of the Applicative implementations for Optional and Array. This adds two new operators to the mix for each type:

  • <* performs an applicative operation, discarding the right hand value
  • *> performs an applicative operation, discarding the left hand value

We're also adding full implementations for Alternative for both types:

  • <|> performs an alternative operation
  • empty constructs an empty value (basically the dual of pure)
  • Optional now has an .or instance method that acts as a named version of <|>.