Skip to content
This repository was archived by the owner on Feb 8, 2022. It is now read-only.
This repository was archived by the owner on Feb 8, 2022. It is now read-only.

Semigroup/Monoid.combineN: Express partiality with values not exceptions #84

Description

@jbgi

After reading http://plastic-idolatry.com/erik/sw2015.pdf it looks like
Semigroup.combineN and Monoid.combineN currently only meet goal number 7 (Pragmatic) but not goal number 2 (Safe: Express partiality with values not exceptions).

  /**
   * Return `a` combined with itself `n` times.
   */
  def combineN(a: A, n: Int): A =
    if (n <= 0) throw new IllegalArgumentException("Repeated combining for semigroups must have n > 0")
    else repeatedCombineN(a, n)

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions