Divide

public protocol Divide : Contravariant

Divide is a typeclass that models the divide part of divide and conquer.

Divide basically states: Given a Kind and a Kind and a way to turn C into a tuple of A and B it gives you a Kind.

  • divide takes two data-types of type Kind and Kind and produces a type of Kind when given a function from © -> (A, B).

    Declaration

    Swift

    static func divide<A, B, C>(_ fa: Kind<Self, A>, _ fb: Kind<Self, B>, _ f: (C) -> (A, B)) -> Kind<Self, C>

    Parameters

    fa

    data of type Kind

    fb

    data of type Kind

    f

    a function to transform C into (A, B)

    Return Value

    Kind