1
import Bow
2
import SwiftCheck
3

4
// MARK: Generator for Property-based Testing
5

6
extension Function0: Arbitrary where A: Arbitrary {
7 1
    public static var arbitrary: Gen<Function0<A>> {
8 1
        return A.arbitrary.map { a in Function0 { a } }
9
    }
10
}
11

12
// MARK: Instance of `ArbitraryK` for `Function0`
13

14
extension ForFunction0: ArbitraryK {
15 1
    public static func generate<A>() -> Kind<ForFunction0, A> where A : Arbitrary {
16 1
        return Function0.arbitrary.generate
17
    }
18
}

Read our documentation on viewing source code .

Loading