Sum

public struct Sum<Value> : MonoidView where Value : Additive
extension Sum: Additive

Additive monoidal view of a Additive-conforming type.

Type Properties

  • Declaration

    Swift

    public static var identity: Sum { get }

    Return Value

    The additive identity wrapped in a AdditiveMonoid.

Type Methods

  • Declaration

    Swift

    public static func <> (lhs: Sum, rhs: Sum) -> Sum

    Return Value

    The composition of the two given values.

Instance Properties

  • Value wrapped by AdditiveMonoid.

    Declaration

    Swift

    public let value: Value

Initializers

  • Creates a AdditiveMonoid with the given value.

    Declaration

    Swift

    public init(_ value: Value)

Additive

  • Declaration

    Swift

    public static var zero: Sum<Value> { get }

    Return Value

    The wrapped-up zero type property of the wrapped type.

  • Declaration

    Swift

    public static func + (lhs: Sum<Value>, rhs: Sum<Value>) -> Sum<Value>

    Return Value

    The wrapped-up sum of the two given values.