@@ -577,55 +577,55 @@ object Gen extends GenArities with GenVersionSpecific {
577
577
578
578
// // List Generators ////
579
579
580
- /** Generates a container of any Iterable type for which there exists an
580
+ /** Generates a container of any Traversable type for which there exists an
581
581
* implicit [[org.scalacheck.util.Buildable ]] instance. The elements in the
582
582
* container will be generated by the given generator. The size of the
583
583
* generated container is limited by `n`. Depending on what kind of container
584
584
* that is generated, the resulting container may contain fewer elements than
585
585
* `n`, but not more. If the given generator fails generating a value, the
586
586
* complete container generator will also fail. */
587
587
def buildableOfN [C ,T ](n : Int , g : Gen [T ])(implicit
588
- evb : Buildable [T ,C ], evt : C => Iterable [T ]
588
+ evb : Buildable [T ,C ], evt : C => Traversable [T ]
589
589
): Gen [C ] =
590
- sequence[C ,T ](Iterable .fill(n)(g)) suchThat { c =>
590
+ sequence[C ,T ](Traversable .fill(n)(g)) suchThat { c =>
591
591
// TODO: Can we guarantee c.size == n (See issue #89)?
592
592
c.forall(g.sieveCopy)
593
593
}
594
594
595
- /** Generates a container of any Iterable type for which there exists an
595
+ /** Generates a container of any Traversable type for which there exists an
596
596
* implicit [[org.scalacheck.util.Buildable ]] instance. The elements in the
597
597
* container will be generated by the given generator. The size of the
598
598
* container is bounded by the size parameter used when generating values. */
599
599
def buildableOf [C ,T ](g : Gen [T ])(implicit
600
- evb : Buildable [T ,C ], evt : C => Iterable [T ]
600
+ evb : Buildable [T ,C ], evt : C => Traversable [T ]
601
601
): Gen [C ] =
602
602
sized(s => choose(0 , s max 0 ).flatMap(buildableOfN[C ,T ](_,g))) suchThat { c =>
603
603
if (c == null ) g.sieveCopy(null ) else c.forall(g.sieveCopy)
604
604
}
605
605
606
- /** Generates a non-empty container of any Iterable type for which there
606
+ /** Generates a non-empty container of any Traversable type for which there
607
607
* exists an implicit [[org.scalacheck.util.Buildable ]] instance. The
608
608
* elements in the container will be generated by the given generator. The
609
609
* size of the container is bounded by the size parameter used when
610
610
* generating values. */
611
611
def nonEmptyBuildableOf [C ,T ](g : Gen [T ])(implicit
612
- evb : Buildable [T ,C ], evt : C => Iterable [T ]
612
+ evb : Buildable [T ,C ], evt : C => Traversable [T ]
613
613
): Gen [C ] =
614
614
sized(s => choose(1 , s max 1 ).flatMap(buildableOfN[C ,T ](_,g))) suchThat(_.size > 0 )
615
615
616
616
/** A convenience method for calling `buildableOfN[C[T],T](n,g)`. */
617
617
def containerOfN [C [_],T ](n : Int , g : Gen [T ])(implicit
618
- evb : Buildable [T ,C [T ]], evt : C [T ] => Iterable [T ]
618
+ evb : Buildable [T ,C [T ]], evt : C [T ] => Traversable [T ]
619
619
): Gen [C [T ]] = buildableOfN[C [T ],T ](n,g)
620
620
621
621
/** A convenience method for calling `buildableOf[C[T],T](g)`. */
622
622
def containerOf [C [_],T ](g : Gen [T ])(implicit
623
- evb : Buildable [T ,C [T ]], evt : C [T ] => Iterable [T ]
623
+ evb : Buildable [T ,C [T ]], evt : C [T ] => Traversable [T ]
624
624
): Gen [C [T ]] = buildableOf[C [T ],T ](g)
625
625
626
626
/** A convenience method for calling `nonEmptyBuildableOf[C[T],T](g)`. */
627
627
def nonEmptyContainerOf [C [_],T ](g : Gen [T ])(implicit
628
- evb : Buildable [T ,C [T ]], evt : C [T ] => Iterable [T ]
628
+ evb : Buildable [T ,C [T ]], evt : C [T ] => Traversable [T ]
629
629
): Gen [C [T ]] = nonEmptyBuildableOf[C [T ],T ](g)
630
630
631
631
/** Generates a list of random length. The maximum length depends on the
@@ -656,7 +656,7 @@ object Gen extends GenArities with GenVersionSpecific {
656
656
* is equal to calling <code>containerOfN[Map,T,U](n,g)</code>. */
657
657
def mapOfN [T ,U ](n : Int , g : Gen [(T ,U )]) = buildableOfN[Map [T ,U ],(T ,U )](n,g)
658
658
659
- /** Generates an infinite lazy list . */
659
+ /** Generates an infinite stream . */
660
660
def infiniteStream [T ](g : => Gen [T ]): Gen [Stream [T ]] = {
661
661
def unfold [A , S ](z : S )(f : S => Option [(A , S )]): Stream [A ] = f(z) match {
662
662
case Some ((h, s)) => h #:: unfold(s)(f)
0 commit comments