diff --git a/src/Hedgehog/Gen.fs b/src/Hedgehog/Gen.fs index 92134acd..a4e9995e 100644 --- a/src/Hedgehog/Gen.fs +++ b/src/Hedgehog/Gen.fs @@ -38,7 +38,7 @@ module Gen = let run (seed : Seed) (random : Random<'x>) : 'x = Random.run seed size random - Tree.bind (run seed1 m) (run seed2 << k)) + Tree.bind (k >> run seed2) (run seed1 m)) let bind (k : 'a -> Gen<'b>) (m : Gen<'a>) : Gen<'b> = toRandom m |> bindRandom (toRandom << k) |> ofRandom diff --git a/src/Hedgehog/Tree.fs b/src/Hedgehog/Tree.fs index 42c6873c..c6bf04ed 100644 --- a/src/Hedgehog/Tree.fs +++ b/src/Hedgehog/Tree.fs @@ -25,14 +25,14 @@ module Tree = let rec map (f : 'a -> 'b) (Node (x, xs) : Tree<'a>) : Tree<'b> = Node (f x, Seq.map (map f) xs) - let rec bind (Node (x, xs0) : Tree<'a>) (k : 'a -> Tree<'b>) : Tree<'b> = + let rec bind (k : 'a -> Tree<'b>) (Node (x, xs0) : Tree<'a>) : Tree<'b> = match k x with | Node (y, ys) -> - let xs = Seq.map (fun m -> bind m k) xs0 + let xs = Seq.map (bind k) xs0 Node (y, Seq.append xs ys) let join (xss : Tree>) : Tree<'a> = - bind xss id + bind id xss /// Turns a tree, in to a tree of trees. Useful for testing Hedgehog itself as /// it allows you to observe the shrinks for a value inside a property,