diff --git a/src/Hedgehog/Hedgehog.fsproj b/src/Hedgehog/Hedgehog.fsproj index bc3f4a83..0454f9e8 100644 --- a/src/Hedgehog/Hedgehog.fsproj +++ b/src/Hedgehog/Hedgehog.fsproj @@ -28,6 +28,7 @@ https://github.com/hedgehogqa/fsharp-hedgehog/blob/master/doc/index.md + diff --git a/src/Hedgehog/Seq.fs b/src/Hedgehog/Seq.fs new file mode 100644 index 00000000..0f32b822 --- /dev/null +++ b/src/Hedgehog/Seq.fs @@ -0,0 +1,17 @@ +[] +module internal Seq + +let inline cons (x : 'a) (xs : seq<'a>) : seq<'a> = + seq { + yield x + yield! xs + } + +let inline consNub (x : 'a) (ys0 : seq<'a>) : seq<'a> = + match Seq.tryHead ys0 with + | None -> Seq.singleton x + | Some y -> + if x = y then + ys0 + else + cons x ys0 diff --git a/src/Hedgehog/Shrink.fs b/src/Hedgehog/Shrink.fs index e89c80f0..66be69b2 100644 --- a/src/Hedgehog/Shrink.fs +++ b/src/Hedgehog/Shrink.fs @@ -1,21 +1,5 @@ namespace Hedgehog -module Seq = - let cons (x : 'a) (xs : seq<'a>) : seq<'a> = - seq { - yield x - yield! xs - } - - let consNub (x : 'a) (ys0 : seq<'a>) : seq<'a> = - match Seq.tryHead ys0 with - | None -> Seq.singleton x - | Some y -> - if x = y then - ys0 - else - cons x ys0 - module Shrink = /// Produce all permutations of removing 'k' elements from a list.