struct RangedTerm { typealias Term = Cofree)> let term: Term } struct UnannotatedTerm { typealias Term = Cofree let term: Term } extension UnannotatedTerm: Arbitrary { static var arbitrary: Gen { let leaf: Gen = String.arbitrary.fmap { Term((), .Leaf($0)) } return Gen.oneOf([ leaf, ]).fmap { UnannotatedTerm(term: $0) } } } @testable import Doubt import SwiftCheck