1
import Bow
2
import SwiftCheck
3

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

6
extension Kleisli: Arbitrary where F: ArbitraryK, A: Arbitrary {
7 0
    public static var arbitrary: Gen<Kleisli<F, D, A>> {
8 0
        return Gen.from(KleisliPartial.generate >>> Kleisli.fix)
9
    }
10
}
11

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

14
extension KleisliPartial: ArbitraryK where F: ArbitraryK {
15 1
    public static func generate<A: Arbitrary>() -> Kind<KleisliPartial<F, D>, A> {
16 1
        let x: Kind<F, A> = F.generate()
17 1
        return Kleisli { _ in x }
18
    }
19
}

Read our documentation on viewing source code .

Loading