Back to Fpinscala

13.Answer

answerkey/testing/13.answer.md

latest198 B
Original Source
scala
extension [A](self: Gen[A]) def nonEmptyList: SGen[List[A]] =
  n => listOfN(n.max(1))

val maxProp = Prop.forAll(smallInt.nonEmptyList): ns => 
  val max = ns.max
  !ns.exists(_ > max)