Skip to content

Commit a02e1cd

Browse files
committed
Document usage of some Sequence
1 parent 28ea0a2 commit a02e1cd

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Example with multiple inputs, and a custom repeat count:
3535
import Testing
3636
import PropertyBased
3737

38-
let stringCreator = Gen.letterOrNumber.string(of: Gen.int(in: 1...10))
38+
let stringCreator: Generator<String, some Sequence> = Gen.letterOrNumber.string(of: 1...10)
3939

4040
@Test func testStringRepeat() async {
4141
await propertyCheck(count: 500, input: stringCreator, Gen.int(in: 0...5)) { str, n in

Sources/PropertyBased/Generator.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
///
66
/// A Generator contains a specific function that creates new values, as well as a function
77
/// that builds a shrinking sequence for any value.
8+
///
9+
/// In most cases, the exact type of `ShrinkSequence` doesn't need to be public in your code, and the `some` keyword can be used instead.
10+
/// ```swift
11+
/// let gen = Generator<Output, some Sequence> = ...
12+
/// ```
813
public struct Generator<ResultValue, ShrinkSequence: Sequence>: Sendable {
914
public typealias InputValue = ShrinkSequence.Element
1015

0 commit comments

Comments
 (0)