1
import Foundation
2

3
/// A MonoidK is a `SemigroupK` that also has an empty element.
4
public protocol MonoidK: SemigroupK {
5
    /// Empty element.
6
    ///
7
    /// This element must obey the following laws:
8
    ///
9
    ///     combineK(fa, emptyK()) == combineK(emptyK(), fa) == fa
10
    ///
11
    /// - Returns: A value representing the empty element of this MonoidK instance.
12
    static func emptyK<A>() -> Kind<Self, A>
13
}
14

15
// MARK: Syntax for MonoidK
16

17
public extension Kind where F: MonoidK {
18
    /// Empty element.
19
    ///
20
    /// This element must obey the following laws:
21
    ///
22
    ///     combineK(fa, emptyK()) == combineK(emptyK(), fa) == fa
23
    ///
24
    /// This is a convenience method to call `MonoidK.emptyK` as a static method of this type.
25
    ///
26
    /// - Returns: A value representing the empty element of this MonoidK instance.
27 1
    static func emptyK() -> Kind<F, A> {
28 1
        return F.emptyK()
29
    }
30
}

Read our documentation on viewing source code .

Loading