Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made Seq module internal and moved to own file #307

Merged
2 commits merged into from
Feb 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Hedgehog/Hedgehog.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ https://github.com/hedgehogqa/fsharp-hedgehog/blob/master/doc/index.md
<Compile Include="AutoOpen.fs" />
<Compile Include="Numeric.fs" />
<Compile Include="Seed.fs" />
<Compile Include="Seq.fs" />
<Compile Include="Tree.fs" />
<Compile Include="OptionTree.fs" />
<Compile Include="Range.fs" />
Expand Down
17 changes: 17 additions & 0 deletions src/Hedgehog/Seq.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[<RequireQualifiedAccess>]
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
16 changes: 0 additions & 16 deletions src/Hedgehog/Shrink.fs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down