From c84578402c8ada6e25f87ff2abdad00b524e4494 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 22 Oct 2015 18:09:18 -0400 Subject: [PATCH] Document `CofreeType.zip`. --- prototype/Doubt/Cofree.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prototype/Doubt/Cofree.swift b/prototype/Doubt/Cofree.swift index d74f73cb6..b79c5ee80 100644 --- a/prototype/Doubt/Cofree.swift +++ b/prototype/Doubt/Cofree.swift @@ -125,6 +125,9 @@ extension CofreeType { return (Wrap(seed) <<< { $0.map(coiterate(unfold)) } <<< unfold) <| seed } + /// `Zip` two `CofreeType` values into a single `Cofree`, pairing their annotations. + /// + /// This is partial, returning `nil` for any pair of values which are not of the same “shape,” i.e. where they wrap `Syntax` values of different constructors. The values of leaves are always taken from the second parameter. public static func zip(a: Self, _ b: Self) -> Cofree? { let annotations = (a.extract, b.extract) switch (a.unwrap, b.unwrap) {