Protocols

The following protocols are available globally.

  • The protocol of monoids (types with an associative binary operation that has an identity).

    Instances should satisfy the following laws:

    x.mappend(.mempty) = x
    T.mempty.mappend(x) = x
    x.mappend(y.mappend(z)) = x.mappend(y).mappend(z)
    [x, y, z].mconcat() = [x, y, z].reduce(T.mempty, { $0.mappend($1) }
    
    See more

    Declaration

    Swift

    public protocol Monoid