Day

public final class Day<F, G, A> : DayOf<F, G, A> where F : Comonad, G : Comonad

Day convolution of two Functors. It can be seen as the suspended version of a Pairing between Functors F and G, applied to specific values.

  • Initializes the Day convolution.

    Declaration

    Swift

    public init<B, C>(left: Kind<F, B>,
                      right: Kind<G, C>,
                      _ f: @escaping (B, C) -> A)

    Parameters

    left

    An F-effectful value.

    right

    A G-effectful value.

    f

    A function to combine the values provided by both effectful computations.

  • Safe downcast.

    Declaration

    Swift

    public static func fix(_ value: DayOf<F, G, A>) -> Day<F, G, A>

    Parameters

    value

    Value in the higher-kind form.

    Return Value

    Value cast to Day.

  • Runs the Day convolution.

    Declaration

    Swift

    public func run() -> A

    Return Value

    Result of the convolution.

  • Associates the convolution of three Functors to the left.

    It goes from Day f (Day g h) a to Day (Day f g) h a.

    Declaration

    Swift

    public func assoc<FF: Comonad, GG: Comonad>() -> Day<DayPartial<F, FF>, GG, A>
        where G == DayPartial<FF, GG>

    Return Value

    Left associated Day convolution.

  • Associates the convolution of three Functors to the right.

    It goes from Day (Day f g) h a to Day f (Day g h) a.

    Declaration

    Swift

    public func disassoc<FF: Comonad, GG: Comonad>() -> Day<FF, DayPartial<GG, G>, A>
        where F == DayPartial<FF, GG>

    Return Value

    Right associated Day convolution.

  • Swaps the convoluted Functors.

    Declaration

    Swift

    public func swapped() -> Day<G, F, A>

    Return Value

    A Day convolution with Functors swapped.

  • Applies a natural transformation on the first Functor.

    Declaration

    Swift

    public func trans1<H>(_ nat: FunctionK<F, H>) -> Day<H, G, A> where H : Comonad

    Parameters

    nat

    Natural transformation.

    Return Value

    Day convolution with the first Functor transformed.

  • Applies a natural transformation on the second Functor.

    Declaration

    Swift

    public func trans2<H>(_ nat: FunctionK<G, H>) -> Day<F, H, A> where H : Comonad

    Parameters

    nat

    Natural transformation.

    Return Value

    Day convolution with the second Functor transformed.

  • Collapses the convolution using Applicative.map.

    Declaration

    Swift

    func dap() -> Kind<F, A>

    Return Value

    Result of the convolution.

  • Introduces Id at the left to make a Day convolution.

    Declaration

    Swift

    static func intro1(_ right: Kind<G, A>) -> Day<ForId, G, A>

    Parameters

    right

    Value for the right side of the convolution.

    Return Value

    A convolution with the provided value on the right.

  • Eliminates Id from the left of this convolution.

    Declaration

    Swift

    func elim1() -> Kind<G, A>

    Return Value

    Result of eliminating Id from the left of the convolution.

  • Introduces Id at the right to make a Day convolution.

    Declaration

    Swift

    static func intro2(_ left: Kind<F, A>) -> Day<F, ForId, A>

    Parameters

    right

    Value for the left side of the convolution.

    Return Value

    A convolution with the provided value on the left.

  • Eliminates Id from the right of this convolution.

    Declaration

    Swift

    func elim2() -> Kind<F, A>

    Return Value

    Result of eliminating Id from the right of the convolution.